<!doctype html><html lang="en">
 <head>
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
  <meta content="#3c790a" name="theme-color">
  <title>Infra Standard</title>
  <link crossorigin href="https://resources.whatwg.org/spec.css" rel="stylesheet">
  <link crossorigin href="https://resources.whatwg.org/standard.css" rel="stylesheet">
  <link crossorigin href="https://resources.whatwg.org/standard-shared-with-dev.css" rel="stylesheet">
  <link crossorigin href="https://resources.whatwg.org/logo-infra.svg" rel="icon">
<script async crossorigin src="https://resources.whatwg.org/file-issue.js"></script>
<script async crossorigin src="https://resources.whatwg.org/commit-snapshot-shortcut-key.js"></script>
<style>/* style-dfn-panel */

.dfn-panel {
    position: absolute;
    z-index: 35;
    height: auto;
    width: -webkit-fit-content;
    width: fit-content;
    max-width: 300px;
    max-height: 500px;
    overflow: auto;
    padding: 0.5em 0.75em;
    font: small Helvetica Neue, sans-serif, Droid Sans Fallback;
    background: #DDDDDD;
    color: black;
    border: outset 0.2em;
}
.dfn-panel:not(.on) { display: none; }
.dfn-panel * { margin: 0; padding: 0; text-indent: 0; }
.dfn-panel > b { display: block; }
.dfn-panel a { color: black; }
.dfn-panel a:not(:hover) { text-decoration: none !important; border-bottom: none !important; }
.dfn-panel > b + b { margin-top: 0.25em; }
.dfn-panel ul { padding: 0; }
.dfn-panel li { list-style: inside; }
.dfn-panel.activated {
    display: inline-block;
    position: fixed;
    left: .5em;
    bottom: 2em;
    margin: 0 auto;
    max-width: calc(100vw - 1.5em - .4em - .5em);
    max-height: 30vh;
}

.dfn-paneled { cursor: pointer; }
</style>
 <body class="h-entry status-LS">
  <div class="head">
   <p data-fill-with="logo"><a class="logo" href="https://whatwg.org/"> <img alt="WHATWG" crossorigin height="100" src="https://resources.whatwg.org/logo-infra.svg"> </a> </p>
   <hgroup>
    <h1 class="p-name no-ref" id="title">Infra</h1>
    <h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Living Standard — Last Updated <time class="dt-updated" datetime="1970-01-01">1 January 1970</time></span></h2>
   </hgroup>
   <div data-fill-with="spec-metadata">
    <dl>
     <dt>Participate:
     <dd><a href="https://github.com/whatwg/infra">GitHub whatwg/infra</a> (<a href="https://github.com/whatwg/infra/issues/new">new issue</a>, <a href="https://github.com/whatwg/infra/issues">open issues</a>)
     <dd><a href="https://wiki.whatwg.org/wiki/IRC">IRC: #whatwg on Freenode</a>
     <dt>Commits:
     <dd><a href="https://github.com/whatwg/infra/commits">GitHub whatwg/infra/commits</a>
     <dd>[SNAPSHOT-LINK]
     <dd><a href="https://twitter.com/infrastandard">@infrastandard</a>
     <dt>Tests:
     <dd><a href="https://github.com/web-platform-tests/wpt/tree/master/infra">web-platform-tests infra/</a> (<a href="https://github.com/web-platform-tests/wpt/labels/infra">ongoing work</a>)
     <dt>Translations <small>(non-normative)</small>:
     <dd><span title="Japanese"><a href="https://triple-underscore.github.io/infra-ja.html" hreflang="ja" lang="ja" rel="alternate">日本語</a></span>
    </dl>
   </div>
   <div data-fill-with="warning"></div>
  </div>
  <div class="p-summary" data-fill-with="abstract">
   <h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2>
   <p>The Infra Standard aims to define the fundamental concepts upon which standards are built.</p>
  </div>
  <nav data-fill-with="table-of-contents" id="toc">
   <h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2>
   <ol class="toc" role="directory">
    <li><a href="#goals"><span class="secno"></span> <span class="content">Goals</span></a>
    <li><a href="#usage"><span class="secno">1</span> <span class="content">Usage</span></a>
    <li>
     <a href="#conventions"><span class="secno">2</span> <span class="content">Conventions</span></a>
     <ol class="toc">
      <li><a href="#conformance"><span class="secno">2.1</span> <span class="content">Conformance</span></a>
      <li><a href="#other-specs"><span class="secno">2.2</span> <span class="content">Compliance with other specifications</span></a>
      <li><a href="#terminology"><span class="secno">2.3</span> <span class="content">Terminology</span></a>
     </ol>
    <li>
     <a href="#algorithms"><span class="secno">3</span> <span class="content">Algorithms</span></a>
     <ol class="toc">
      <li><a href="#variables"><span class="secno">3.1</span> <span class="content">Variables</span></a>
      <li><a href="#algorithm-control-flow"><span class="secno">3.2</span> <span class="content">Control flow</span></a>
      <li><a href="#algorithm-conditional-abort"><span class="secno">3.3</span> <span class="content">Conditional abort</span></a>
      <li><a href="#algorithm-iteration"><span class="secno">3.4</span> <span class="content">Iteration</span></a>
      <li><a href="#assertions"><span class="secno">3.5</span> <span class="content">Assertions</span></a>
     </ol>
    <li>
     <a href="#primitive-data-types"><span class="secno">4</span> <span class="content">Primitive data types</span></a>
     <ol class="toc">
      <li><a href="#nulls"><span class="secno">4.1</span> <span class="content">Nulls</span></a>
      <li><a href="#booleans"><span class="secno">4.2</span> <span class="content">Booleans</span></a>
      <li><a href="#bytes"><span class="secno">4.3</span> <span class="content">Bytes</span></a>
      <li><a href="#byte-sequences"><span class="secno">4.4</span> <span class="content">Byte sequences</span></a>
      <li><a href="#code-points"><span class="secno">4.5</span> <span class="content">Code points</span></a>
      <li><a href="#strings"><span class="secno">4.6</span> <span class="content">Strings</span></a>
     </ol>
    <li>
     <a href="#data-structures"><span class="secno">5</span> <span class="content">Data structures</span></a>
     <ol class="toc">
      <li>
       <a href="#lists"><span class="secno">5.1</span> <span class="content">Lists</span></a>
       <ol class="toc">
        <li><a href="#stacks"><span class="secno">5.1.1</span> <span class="content">Stacks</span></a>
        <li><a href="#queues"><span class="secno">5.1.2</span> <span class="content">Queues</span></a>
        <li><a href="#sets"><span class="secno">5.1.3</span> <span class="content">Sets</span></a>
       </ol>
      <li><a href="#maps"><span class="secno">5.2</span> <span class="content">Maps</span></a>
      <li><a href="#structs"><span class="secno">5.3</span> <span class="content">Structs</span></a>
     </ol>
    <li><a href="#json"><span class="secno">6</span> <span class="content">JSON</span></a>
    <li><a href="#forgiving-base64"><span class="secno">7</span> <span class="content">Forgiving base64</span></a>
    <li><a href="#namespaces"><span class="secno">8</span> <span class="content">Namespaces</span></a>
    <li><a href="#acknowledgments"><span class="secno"></span> <span class="content">Acknowledgments</span></a>
    <li>
     <a href="#index"><span class="secno"></span> <span class="content">Index</span></a>
     <ol class="toc">
      <li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a>
      <li><a href="#index-defined-elsewhere"><span class="secno"></span> <span class="content">Terms defined by reference</span></a>
     </ol>
    <li>
     <a href="#references"><span class="secno"></span> <span class="content">References</span></a>
     <ol class="toc">
      <li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a>
      <li><a href="#informative"><span class="secno"></span> <span class="content">Informative References</span></a>
     </ol>
   </ol>
  </nav>
  <main>
   <h2 class="no-num heading settled" id="goals"><span class="content">Goals</span></h2>
   <ul>
    <li>
     <p>Deduplicate boilerplate in standards. </p>
    <li>
     <p>Align standards on conventions, terminology, and data structures. </p>
    <li>
     <p>Be a place for concepts used by multiple standards without a good home. </p>
    <li>
     <p>Help write clear and readable algorithmic prose by clarifying otherwise ambiguous concepts. </p>
   </ul>
   <p>Suggestions for more goals welcome.</p>
   <h2 class="heading settled" data-level="1" id="usage"><span class="secno">1. </span><span class="content">Usage</span><a class="self-link" href="#usage"></a></h2>
   <p>To make use of the Infra Standard in a document titled <var>X</var>, use <samp><var>X</var> depends on the Infra Standard</samp>. Additionally, cross-referencing terminology
is encouraged to avoid ambiguity. </p>
   <p>Specification authors are also encouraged to add their specification to the <a href="https://github.com/whatwg/infra/wiki/Dependent-specs">list of dependent specifications</a> in
order to help the editors ensure that any future breaking changes to the Infra Standard are
correctly reflected by any such dependencies. </p>
   <h2 class="heading settled" data-level="2" id="conventions"><span class="secno">2. </span><span class="content">Conventions</span><a class="self-link" href="#conventions"></a></h2>
   <h3 class="heading settled" data-level="2.1" id="conformance"><span class="secno">2.1. </span><span class="content">Conformance</span><a class="self-link" href="#conformance"></a></h3>
   <p>All assertions, diagrams, examples, and notes are non-normative, as are all sections explicitly
marked non-normative. Everything else is normative. </p>
   <p>The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT",
"RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" are to be interpreted as described in
RFC 2119. <a data-link-type="biblio" href="#biblio-rfc2119">[RFC2119]</a> </p>
   <p>These keywords have equivalent meaning when written in lowercase and cannot appear in
non-normative content. </p>
   <p class="note" role="note">This is a <a data-link-type="dfn" href="#willful-violation" id="ref-for-willful-violation">willful violation</a> of RFC 8174, motivated by legibility and a desire
to preserve long-standing practice in many non-IETF-published pre-RFC 8174 documents. <a data-link-type="biblio" href="#biblio-rfc8174">[RFC8174]</a> </p>
   <p>All of the above is applicable to both this standard and any document that uses this standard.
Documents using this standard are encouraged to limit themselves to "must", "must not", "should",
and "may", and to use these in their lowercase form as that is generally considered to be more
readable. </p>
   <p>For non-normative content "strongly encouraged", "strongly discouraged", "encouraged",
"discouraged", "can", "cannot", "could", "could not", "might", and "might not" can be used instead. </p>
   <h3 class="heading settled" data-level="2.2" id="other-specs"><span class="secno">2.2. </span><span class="content">Compliance with other specifications</span><a class="self-link" href="#other-specs"></a></h3>
   <p>In general, specifications interact with and rely on a wide variety of other specifications. In
certain circumstances, unfortunately, conflicting needs require a specification to violate the
requirements of other specifications. When this occurs, a document using the Infra Standard should
denote such transgressions as a <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="willful-violation">willful violation</dfn>, and note the reason for that
violation. </p>
   <p class="example" id="example-willful-violation"><a class="self-link" href="#example-willful-violation"></a>The previous section, <a href="#conformance">§ 2.1 Conformance</a>, documents a <a data-link-type="dfn" href="#willful-violation" id="ref-for-willful-violation①">willful violation</a> of RFC 8174 committed by the Infra Standard. </p>
   <h3 class="heading settled" data-level="2.3" id="terminology"><span class="secno">2.3. </span><span class="content">Terminology</span><a class="self-link" href="#terminology"></a></h3>
   <p>The word "or", in cases where both inclusive "or" and exclusive "or" are possible (e.g., "if
either width or height is zero"), means an inclusive "or" (implying "or both"), unless it is called
out as being exclusive (with "but not both"). </p>
   <p>A <dfn data-dfn-type="dfn" data-export id="user-agent">user agent<a class="self-link" href="#user-agent"></a></dfn> is any software that acts on behalf of a user, for example by
retrieving and rendering web content and facilitating end user interaction with it. In
specifications using the Infra Standard, the user agent is generally the client software that
implements the specification. </p>
   <h2 class="heading settled" data-level="3" id="algorithms"><span class="secno">3. </span><span class="content">Algorithms</span><a class="self-link" href="#algorithms"></a></h2>
   <p>Algorithms, and requirements phrased in the imperative as part of algorithms (such as "strip any
leading spaces" or "return false") are to be interpreted with the meaning of the keyword (e.g.,
"must") used in introducing the algorithm or step. If no such keyword is used, must is implied. </p>
   <div class="example" id="example-algorithms">
    <a class="self-link" href="#example-algorithms"></a> 
    <p>For example, were the spec to say:</p>
    <blockquote>
     <p class="allow-2119">To eat an orange, the user must: </p>
     <ol class="brief">
      <li>Peel the orange. 
      <li>Separate each slice of the orange. 
      <li>Eat the orange slices. 
     </ol>
    </blockquote>
    <p>it would be equivalent to the following:</p>
    <blockquote>
     <p>To eat an orange: </p>
     <ol class="brief">
      <li class="allow-2119">The user must peel the orange. 
      <li class="allow-2119">The user must separate each slice of the orange. 
      <li class="allow-2119">The user must eat the orange slices. 
     </ol>
    </blockquote>
    <p class="allow-2119">Here the key word is "must".</p>
    <p class="allow-2119">Modifying the above example, if the algorithm was introduced only with "To eat
 an orange:", it would still have the same meaning, as "must" is implied. </p>
   </div>
   <p>Conformance requirements phrased as algorithms or specific steps may be implemented in any
manner, so long as the end result is equivalent. (In particular, the algorithms are intended to be
easy to follow, and not intended to be performant.) </p>
   <p class="note" role="note">Performance is tricky to get correct as it is influenced by user perception, computer
architectures, and different types of input that can change over time in how common they are. For
instance, a JavaScript engine likely has many different code paths for what is standardized as a
single algorithm, in order to optimize for speed or memory consumption. Standardizing all those code
paths would be an insurmountable task and not productive as they would not stand the test of time
as well as the single algorithm would. Therefore performance is best left as a field to compete
over. </p>
   <h3 class="heading settled" data-level="3.1" id="variables"><span class="secno">3.1. </span><span class="content">Variables</span><a class="self-link" href="#variables"></a></h3>
   <p>A variable is declared with "let" and changed with "set". </p>
   <p class="example" id="example-variable"><a class="self-link" href="#example-variable"></a>Let <var>list</var> be a new <a data-link-type="dfn" href="#list" id="ref-for-list">list</a>.</p>
   <div class="example" id="example-variable-null">
    <a class="self-link" href="#example-variable-null"></a> 
    <ol>
     <li>
      <p>Let <var>value</var> be null. </p>
     <li>
      <p>If <var>input</var> is a <a data-link-type="dfn" href="#string" id="ref-for-string">string</a>, then set <var>value</var> to <var>input</var>. </p>
     <li>
      <p>Otherwise, set <var>value</var> to <var>input</var>, <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8-decode" id="ref-for-utf-8-decode">UTF-8 decoded</a>. </p>
     <li>
      <p><a data-link-type="dfn" href="#assert" id="ref-for-assert">Assert</a>: <var>value</var> is a <a data-link-type="dfn" href="#string" id="ref-for-string①">string</a>. </p>
    </ol>
   </div>
   <p class="example" id="example-variable-ternary"><a class="self-link" href="#example-variable-ternary"></a>Let <var>activationTarget</var> be <var>target</var> if <var>isActivationEvent</var> is true and target has activation
behavior; otherwise null. </p>
   <p>Variables must not be used before they are declared. Variables are <a href="https://en.wikipedia.org/wiki/Scope_(computer_science)#Block_scope">block scoped</a>.
Variables must not be declared more than once per algorithm. </p>
   <h3 class="heading settled" data-level="3.2" id="algorithm-control-flow"><span class="secno">3.2. </span><span class="content">Control flow</span><a class="self-link" href="#algorithm-control-flow"></a></h3>
   <p>The control flow of algorithms is such that a requirement to "return" or "throw" terminates the
algorithm the statement was in. "Return" will hand the given value, if any, to its caller. "Throw"
will make the caller automatically rethrow the given value, if any, and thereby terminate the
caller’s algorithm. Using prose the caller has the ability to "catch" the exception and perform
another action. </p>
   <h3 class="heading settled" data-level="3.3" id="algorithm-conditional-abort"><span class="secno">3.3. </span><span class="content">Conditional abort</span><a class="self-link" href="#algorithm-conditional-abort"></a></h3>
   <p>Sometimes it is useful to stop performing a series of steps once a condition becomes true. </p>
   <p>To do this, state that a given series of steps will <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="abort-when">abort when</dfn> a specific <var>condition</var> is reached. This indicates that the specified steps must be evaluated, not
as-written, but by additionally inserting a step before each of them that evaluates <var>condition</var>, and if <var>condition</var> evaluates to true, skips the remaining steps. </p>
   <p>In such algorithms, the subsequent step can be annotated to run <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="if-aborted">if aborted</dfn>, in
which case it must run if any of the preceding steps were skipped due to the <var>condition</var> of the preceding <a data-link-type="dfn" href="#abort-when" id="ref-for-abort-when">abort when</a> step evaluated to true. </p>
   <div class="example" id="example-conditional-abort">
    <a class="self-link" href="#example-conditional-abort"></a> 
    <p>The following algorithm </p>
    <ol>
     <li>
      <p>Let <var>result</var> be an empty <a data-link-type="dfn" href="#list" id="ref-for-list①">list</a>. </p>
     <li>
      <p>Run these steps, but <a data-link-type="dfn" href="#abort-when" id="ref-for-abort-when①">abort when</a> the user clicks the "Cancel" button: </p>
      <ol>
       <li>
        <p>Compute the first million digits of <var>π</var>, and <a data-link-type="dfn" href="#list-append" id="ref-for-list-append">append</a> the result
    to <var>result</var>. </p>
       <li>
        <p>Compute the first million digits of <var>e</var>, and <a data-link-type="dfn" href="#list-append" id="ref-for-list-append①">append</a> the result to <var>result</var>. </p>
       <li>
        <p>Compute the first million digits of <var>φ</var>, and <a data-link-type="dfn" href="#list-append" id="ref-for-list-append②">append</a> the result
    to <var>result</var>. </p>
      </ol>
     <li>
      <p><a data-link-type="dfn" href="#if-aborted" id="ref-for-if-aborted">If aborted</a>, <a data-link-type="dfn" href="#list-append" id="ref-for-list-append③">append</a> "<code>Didn’t finish!</code>" to <var>result</var>. </p>
    </ol>
    <p>is equivalent to the more verbose formulation</p>
    <ol>
     <li>
      <p>Let <var>result</var> be an empty <a data-link-type="dfn" href="#list" id="ref-for-list②">list</a>. </p>
     <li>
      <p>If the user has not clicked the "Cancel" button, then: </p>
      <ol>
       <li>
        <p>Compute the first million digits of <var>π</var>, and <a data-link-type="dfn" href="#list-append" id="ref-for-list-append④">append</a> the result
    to <var>result</var>. </p>
       <li>
        <p>If the user has not clicked the "Cancel" button, then: </p>
        <ol>
         <li>
          <p>Compute the first million digits of <var>e</var>, and <a data-link-type="dfn" href="#list-append" id="ref-for-list-append⑤">append</a> the result to <var>result</var>. </p>
         <li>
          <p>If the user has not clicked the "Cancel" button, then compute the first million digits
      of <var>φ</var>, and <a data-link-type="dfn" href="#list-append" id="ref-for-list-append⑥">append</a> the result to <var>result</var>. </p>
        </ol>
      </ol>
     <li>
      <p>If the user clicked the "Cancel" button, then <a data-link-type="dfn" href="#list-append" id="ref-for-list-append⑦">append</a> "<code>Didn’t finish!</code>" to <var>result</var>. </p>
    </ol>
   </div>
   <p class="note" role="note">Whenever this construct is used, implementations are allowed to evaluate <var>condition</var> during the specified steps rather than before and after each step, as long as
the end result is indistinguishable. For instance, as long as <var>result</var> in the above example is not
mutated during a compute operation, the user agent could stop the computation. </p>
   <h3 class="heading settled" data-level="3.4" id="algorithm-iteration"><span class="secno">3.4. </span><span class="content">Iteration</span><a class="self-link" href="#algorithm-iteration"></a></h3>
   <p>There’s a variety of ways to repeat a set of steps until a condition is reached. </p>
   <p class="note" role="note">The Infra Standard is not (yet) exhaustive on this; please file an issue if you need
something. </p>
   <dl>
    <dt>For each 
    <dd>
     <p>As defined <a data-link-type="dfn" href="#list-iterate" id="ref-for-list-iterate">for lists</a> (and derivatives) and <a data-link-type="dfn" href="#map-iterate" id="ref-for-map-iterate">maps</a>. </p>
    <dt><dfn class="dfn-paneled" data-dfn-for="iteration" data-dfn-type="dfn" data-export data-lt="while" id="iteration-while">While</dfn> 
    <dd>
     <p>An instruction to repeat a set of steps as long as a condition is met. </p>
     <div class="example" id="example-while">
      <a class="self-link" href="#example-while"></a> 
      <p>While <var>condition</var> is "<code>met</code>": </p>
      <ol>
       <li>
        <p>… </p>
      </ol>
     </div>
   </dl>
   <p>An iteration’s flow can be controlled via requirements to <dfn class="dfn-paneled" data-dfn-for="iteration" data-dfn-type="dfn" data-export id="iteration-continue">continue</dfn> or <dfn class="dfn-paneled" data-dfn-for="iteration" data-dfn-type="dfn" data-export id="iteration-break">break</dfn>. <a data-link-type="dfn" href="#iteration-continue" id="ref-for-iteration-continue">Continue</a> will skip over any remaining steps in an iteration, proceeding to the
next item. If no further items remain, the iteration will stop. <a data-link-type="dfn" href="#iteration-break" id="ref-for-iteration-break">Break</a> will skip
over any remaining steps in an iteration, and skip over any remaining items as well, stopping the
iteration. </p>
   <div class="example" id="example-break-continue">
    <a class="self-link" href="#example-break-continue"></a> 
    <p>Let <var>example</var> be the <a data-link-type="dfn" href="#list" id="ref-for-list③">list</a> « 1, 2, 3, 4 ». The following prose would perform <var>operation</var> upon 1, then 2, then 3, then 4: </p>
    <ol>
     <li>
      <p><a data-link-type="dfn" href="#list-iterate" id="ref-for-list-iterate①">For each</a> <var>item</var> of <var>example</var>: </p>
      <ol>
       <li>Perform <var>operation</var> on <var>item</var>. 
      </ol>
    </ol>
    <p>The following prose would perform <var>operation</var> upon 1, then 2, then 4. 3 would be skipped. </p>
    <ol>
     <li>
      <p><a data-link-type="dfn" href="#list-iterate" id="ref-for-list-iterate②">For each</a> <var>item</var> of <var>example</var>: </p>
      <ol>
       <li>If <var>item</var> is 3, then <a data-link-type="dfn" href="#iteration-continue" id="ref-for-iteration-continue①">continue</a>. 
       <li>Perform <var>operation</var> on <var>item</var>. 
      </ol>
    </ol>
    <p>The following prose would perform <var>operation</var> upon 1, then 2. 3 and 4 would be skipped. </p>
    <ol>
     <li>
      <p><a data-link-type="dfn" href="#list-iterate" id="ref-for-list-iterate③">For each</a> <var>item</var> of <var>example</var>: </p>
      <ol>
       <li>If <var>item</var> is 3, then <a data-link-type="dfn" href="#iteration-break" id="ref-for-iteration-break①">break</a>. 
       <li>Perform <var>operation</var> on <var>item</var>. 
      </ol>
    </ol>
   </div>
   <h3 class="heading settled" data-level="3.5" id="assertions"><span class="secno">3.5. </span><span class="content">Assertions</span><a class="self-link" href="#assertions"></a></h3>
   <p>To improve readability, it can sometimes help to add assertions to algorithms, stating
invariants. To do this, write "<dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="assert">Assert</dfn>:", followed by a statement that must be
true. If the statement ends up being false that indicates an issue with the document using the Infra
Standard that should be reported and addressed. </p>
   <p class="note" role="note">Since the statement can only ever be true, it has no implications for implementations. </p>
   <div class="example" id="example-assert">
    <a class="self-link" href="#example-assert"></a> 
    <ol>
     <li>
      <p>Let <var>x</var> be "<code>Aperture Science</code>". </p>
     <li>
      <p><a data-link-type="dfn" href="#assert" id="ref-for-assert①">Assert</a>: <var>x</var> is "<code>Aperture Science</code>". </p>
    </ol>
   </div>
   <h2 class="heading settled" data-level="4" id="primitive-data-types"><span class="secno">4. </span><span class="content">Primitive data types</span><a class="self-link" href="#primitive-data-types"></a></h2>
   <h3 class="heading settled" data-level="4.1" id="nulls"><span class="secno">4.1. </span><span class="content">Nulls</span><a class="self-link" href="#nulls"></a></h3>
   <p>The value null is used to indicate the lack of a value. It can be used interchangeably with the
JavaScript <b>null</b> value. <a data-link-type="biblio" href="#biblio-ecma-262">[ECMA-262]</a> </p>
   <p class="example" id="example-null"><a class="self-link" href="#example-null"></a>Let <var>element</var> be null. </p>
   <p class="example" id="example-null-return"><a class="self-link" href="#example-null-return"></a>If <var>input</var> is the empty string, then return null. </p>
   <h3 class="heading settled" data-level="4.2" id="booleans"><span class="secno">4.2. </span><span class="content">Booleans</span><a class="self-link" href="#booleans"></a></h3>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="boolean">boolean</dfn> is either true or false. </p>
   <p class="example" id="example-boolean"><a class="self-link" href="#example-boolean"></a>Let <var>elementSeen</var> be false. </p>
   <h3 class="heading settled" data-level="4.3" id="bytes"><span class="secno">4.3. </span><span class="content">Bytes</span><a class="self-link" href="#bytes"></a></h3>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="byte">byte</dfn> is a sequence of eight bits, represented as a double-digit hexadecimal
number in the range 0x00 to 0xFF, inclusive. </p>
   <p>An <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="ascii-byte">ASCII byte</dfn> is a <a data-link-type="dfn" href="#byte" id="ref-for-byte">byte</a> in the range 0x00 (NUL) to 0x7F (DEL),
inclusive. As illustrated, an <a data-link-type="dfn" href="#ascii-byte" id="ref-for-ascii-byte">ASCII byte</a>, excluding 0x28 and 0x29, may be followed by the
representation outlined in the <a href="https://tools.ietf.org/html/rfc20#section-2">Standard Code</a> section of <cite>ASCII format for Network Interchange</cite>, between parentheses. <a data-link-type="biblio" href="#biblio-rfc20">[RFC20]</a> </p>
   <p>0x28 may be followed by "(left parenthesis)" and 0x29 by "(right parenthesis)". </p>
   <p class="example" id="example-byte-notation"><a class="self-link" href="#example-byte-notation"></a>0x49 (I) when <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8-decode" id="ref-for-utf-8-decode①">UTF-8 decoded</a> becomes the <a data-link-type="dfn" href="#code-point" id="ref-for-code-point">code point</a> U+0049 (I). </p>
   <h3 class="heading settled" data-level="4.4" id="byte-sequences"><span class="secno">4.4. </span><span class="content">Byte sequences</span><a class="self-link" href="#byte-sequences"></a></h3>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="byte-sequence">byte sequence</dfn> is a sequence of <a data-link-type="dfn" href="#byte" id="ref-for-byte①">bytes</a>, represented as a space-separated
sequence of bytes. Byte sequences with bytes in the range 0x20 (SP) to 0x7E (~), inclusive, can
alternately be written as a string, but using backticks instead of quotation marks, to avoid
confusion with an actual <a data-link-type="dfn" href="#string" id="ref-for-string②">string</a>. </p>
   <div class="example" id="example-byte-sequence-notation">
    <a class="self-link" href="#example-byte-sequence-notation"></a> 
    <p>0x48 0x49 can also be represented as `<code>HI</code>`. </p>
    <p>Headers, such as `<code>Content-Type</code>`, are <a data-link-type="dfn" href="#byte-sequence" id="ref-for-byte-sequence">byte sequences</a>. </p>
   </div>
   <p class="note" role="note">To get a <a data-link-type="dfn" href="#byte-sequence" id="ref-for-byte-sequence①">byte sequence</a> out of a <a data-link-type="dfn" href="#string" id="ref-for-string③">string</a>, using <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8-encode" id="ref-for-utf-8-encode">UTF-8 encode</a> from
the Encoding Standard is encouraged. In rare circumstances <a data-link-type="dfn" href="#isomorphic-encode" id="ref-for-isomorphic-encode">isomorphic encode</a> might be needed. <a data-link-type="biblio" href="#biblio-encoding">[ENCODING]</a> </p>
   <p>A <a data-link-type="dfn" href="#byte-sequence" id="ref-for-byte-sequence②">byte sequence</a>’s <dfn class="dfn-paneled" data-dfn-for="byte sequence" data-dfn-type="dfn" data-export id="byte-sequence-length">length</dfn> is the number of <a data-link-type="dfn" href="#byte" id="ref-for-byte②">bytes</a> it contains. </p>
   <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="byte-lowercase">byte-lowercase</dfn> a <a data-link-type="dfn" href="#byte-sequence" id="ref-for-byte-sequence③">byte sequence</a>, increase each <a data-link-type="dfn" href="#byte" id="ref-for-byte③">byte</a> it
contains, in the range 0x41 (A) to 0x5A (Z), inclusive, by 0x20. </p>
   <p>To <dfn data-dfn-type="dfn" data-export id="byte-uppercase">byte-uppercase<a class="self-link" href="#byte-uppercase"></a></dfn> a <a data-link-type="dfn" href="#byte-sequence" id="ref-for-byte-sequence④">byte sequence</a>, subtract each <a data-link-type="dfn" href="#byte" id="ref-for-byte④">byte</a> it
contains, in the range 0x61 (a) to 0x7A (z), inclusive, by 0x20. </p>
   <p>A <a data-link-type="dfn" href="#byte-sequence" id="ref-for-byte-sequence⑤">byte sequence</a> <var>A</var> is a <dfn data-dfn-type="dfn" data-export id="byte-case-insensitive">byte-case-insensitive<a class="self-link" href="#byte-case-insensitive"></a></dfn> match for a <a data-link-type="dfn" href="#byte-sequence" id="ref-for-byte-sequence⑥">byte sequence</a> <var>B</var>, if the <a data-link-type="dfn" href="#byte-lowercase" id="ref-for-byte-lowercase">byte-lowercase</a> of <var>A</var> is the <a data-link-type="dfn" href="#byte-lowercase" id="ref-for-byte-lowercase①">byte-lowercase</a> of <var>B</var>. </p>
   <hr>
   <p>A <a data-link-type="dfn" href="#byte-sequence" id="ref-for-byte-sequence⑦">byte sequence</a> <var>a</var> <dfn class="dfn-paneled" data-dfn-for="byte sequence" data-dfn-type="dfn" data-export id="byte-sequence-starts-with">starts with</dfn> a <a data-link-type="dfn" href="#byte-sequence" id="ref-for-byte-sequence⑧">byte sequence</a> <var>b</var> if the following steps return true: </p>
   <ol>
    <li>
     <p>Let <var>i</var> be 0. </p>
    <li>
     <p><a data-link-type="dfn" href="#iteration-while" id="ref-for-iteration-while">While</a> true: </p>
     <ol>
      <li>
       <p>Let <var>aByte</var> be the <var>i</var>th <a data-link-type="dfn" href="#byte" id="ref-for-byte⑤">byte</a> of <var>a</var> if <var>i</var> is
   less than <var>a</var>’s <a data-link-type="dfn" href="#byte-sequence-length" id="ref-for-byte-sequence-length">length</a>; otherwise null. </p>
      <li>
       <p>Let <var>bByte</var> be the <var>i</var>th <a data-link-type="dfn" href="#byte" id="ref-for-byte⑥">byte</a> of <var>b</var> if <var>i</var> is
   less than <var>b</var>’s <a data-link-type="dfn" href="#byte-sequence-length" id="ref-for-byte-sequence-length①">length</a>; otherwise null. </p>
      <li>
       <p>If <var>bByte</var> is null, then return true. </p>
      <li>
       <p>Return false if <var>aByte</var> is not <var>bByte</var>. </p>
      <li>
       <p>Set <var>i</var> to <var>i</var> + 1. </p>
     </ol>
   </ol>
   <p>A <a data-link-type="dfn" href="#byte-sequence" id="ref-for-byte-sequence⑨">byte sequence</a> <var>a</var> is <dfn data-dfn-type="dfn" data-export id="byte-less-than">byte less than<a class="self-link" href="#byte-less-than"></a></dfn> a <a data-link-type="dfn" href="#byte-sequence" id="ref-for-byte-sequence①⓪">byte sequence</a> <var>b</var> if the following steps return true: </p>
   <ol>
    <li>
     <p>If <var>b</var> <a data-link-type="dfn" href="#byte-sequence-starts-with" id="ref-for-byte-sequence-starts-with">starts with</a> <var>a</var>, then return false. </p>
    <li>
     <p>If <var>a</var> <a data-link-type="dfn" href="#byte-sequence-starts-with" id="ref-for-byte-sequence-starts-with①">starts with</a> <var>b</var>, then return true. </p>
    <li>
     <p>Let <var>n</var> be the smallest index such that the <var>n</var>th <a data-link-type="dfn" href="#byte" id="ref-for-byte⑦">byte</a> of <var>a</var> is different from the <var>n</var>th byte of <var>b</var>. (There has to be such an
 index, since neither byte sequence starts with the other.) </p>
    <li>
     <p>If the <var>n</var>th byte of <var>a</var> is less than the <var>n</var>th byte of <var>b</var>, then return true. </p>
    <li>
     <p>Return false. </p>
   </ol>
   <hr>
   <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="isomorphic-decode">isomorphic decode</dfn> a <a data-link-type="dfn" href="#byte-sequence" id="ref-for-byte-sequence①①">byte sequence</a> <var>input</var>, return a <a data-link-type="dfn" href="#string" id="ref-for-string④">string</a> whose <a data-link-type="dfn" href="#string-length" id="ref-for-string-length">length</a> is equal to <var>input</var>’s <a data-link-type="dfn" href="#byte-sequence-length" id="ref-for-byte-sequence-length②">length</a> and whose <a data-link-type="dfn" href="#code-point" id="ref-for-code-point①">code points</a> have the same values as <var>input</var>’s <a data-link-type="dfn" href="#byte" id="ref-for-byte⑧">bytes</a>, in the same order. </p>
   <h3 class="heading settled" data-level="4.5" id="code-points"><span class="secno">4.5. </span><span class="content">Code points</span><a class="self-link" href="#code-points"></a></h3>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="code point|character" id="code-point">code point</dfn> is a Unicode code point and is
represented as a four-to-six digit hexadecimal number, typically prefixed with "U+". </p>
   <p>A <a data-link-type="dfn" href="#code-point" id="ref-for-code-point②">code point</a> may be followed by its name, by its rendered form between parentheses when it
is not U+0028 or U+0029, or by both. Documents using the Infra Standard are encouraged to follow <a data-link-type="dfn" href="#code-point" id="ref-for-code-point③">code points</a> by their name when they cannot be rendered or are U+0028 or U+0029; otherwise,
follow them by their rendered form between parentheses, for legibility. </p>
   <p>A <a data-link-type="dfn" href="#code-point" id="ref-for-code-point④">code point</a>’s name is defined in the Unicode Standard and represented in <a data-link-type="dfn" href="#ascii-uppercase" id="ref-for-ascii-uppercase">ASCII uppercase</a>. <a data-link-type="biblio" href="#biblio-unicode">[UNICODE]</a> </p>
   <div class="example" id="example-code-point-notation">
    <a class="self-link" href="#example-code-point-notation"></a> 
    <p>The <a data-link-type="dfn" href="#code-point" id="ref-for-code-point⑤">code point</a> rendered as 🤔 is represented as U+1F914. </p>
    <p>When referring to that <a data-link-type="dfn" href="#code-point" id="ref-for-code-point⑥">code point</a>, we might say "U+1F914 (🤔)", to provide extra context.
 Documents are allowed to use "U+1F914 THINKING FACE (🤔)" as well, though this is somewhat verbose. </p>
   </div>
   <p class="example" id="example-code-point-notation-hard-to-render"><a class="self-link" href="#example-code-point-notation-hard-to-render"></a><a data-link-type="dfn" href="#code-point" id="ref-for-code-point⑦">Code points</a> that are difficult
to render unambigiously, such as U+000A, can be referred to as "U+000A LF". U+0029 can be referred
to as "U+0029 RIGHT PARENTHESIS", because even though it renders, this avoids unmatched parentheses. </p>
   <p><a data-link-type="dfn" href="#code-point" id="ref-for-code-point⑧">Code points</a> are sometimes referred to as <a data-link-type="dfn" href="#code-point" id="ref-for-code-point⑨">characters</a> and in certain contexts are
prefixed with "0x" rather than "U+". </p>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="surrogate">surrogate</dfn> is a <a data-link-type="dfn" href="#code-point" id="ref-for-code-point①⓪">code point</a> that is in the range U+D800 to U+DFFF,
inclusive. </p>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="scalar-value">scalar value</dfn> is a <a data-link-type="dfn" href="#code-point" id="ref-for-code-point①①">code point</a> that is not a <a data-link-type="dfn" href="#surrogate" id="ref-for-surrogate">surrogate</a>. </p>
   <p>A <dfn data-dfn-type="dfn" data-export id="noncharacter">noncharacter<a class="self-link" href="#noncharacter"></a></dfn> is a <a data-link-type="dfn" href="#code-point" id="ref-for-code-point①②">code point</a> that is in the range U+FDD0 to U+FDEF,
inclusive, or U+FFFE, U+FFFF, U+1FFFE, U+1FFFF, U+2FFFE, U+2FFFF, U+3FFFE, U+3FFFF, U+4FFFE,
U+4FFFF, U+5FFFE, U+5FFFF, U+6FFFE, U+6FFFF, U+7FFFE, U+7FFFF, U+8FFFE, U+8FFFF, U+9FFFE, U+9FFFF,
U+AFFFE, U+AFFFF, U+BFFFE, U+BFFFF, U+CFFFE, U+CFFFF, U+DFFFE, U+DFFFF, U+EFFFE, U+EFFFF, U+FFFFE,
U+FFFFF, U+10FFFE, or U+10FFFF. </p>
   <p>An <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="ascii-code-point">ASCII code point</dfn> is a <a data-link-type="dfn" href="#code-point" id="ref-for-code-point①③">code point</a> in the range U+0000 NULL to
U+007F DELETE, inclusive. </p>
   <p>An <dfn data-dfn-type="dfn" data-export data-lt="ASCII tab or newline|ASCII tabs or newlines" id="ascii-tab-or-newline">ASCII tab or newline<a class="self-link" href="#ascii-tab-or-newline"></a></dfn> is
U+0009 TAB, U+000A LF, or U+000D CR. </p>
   <p><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="ascii-whitespace">ASCII whitespace</dfn> is U+0009 TAB, U+000A LF, U+000C FF, U+000D CR, or U+0020
SPACE. </p>
   <p class="note" role="note">"Whitespace" is a mass noun. </p>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="c0-control">C0 control</dfn> is a <a data-link-type="dfn" href="#code-point" id="ref-for-code-point①④">code point</a> in the range U+0000 NULL to
U+001F INFORMATION SEPARATOR ONE, inclusive. </p>
   <p>A <dfn data-dfn-type="dfn" data-export data-lt="C0 control or space|C0 controls or spaces" id="c0-control-or-space">C0 control or space<a class="self-link" href="#c0-control-or-space"></a></dfn> is a <a data-link-type="dfn" href="#c0-control" id="ref-for-c0-control">C0 control</a> or U+0020 SPACE. </p>
   <p>A <dfn data-dfn-type="dfn" data-export id="control">control<a class="self-link" href="#control"></a></dfn> is a <a data-link-type="dfn" href="#c0-control" id="ref-for-c0-control①">C0 control</a> or a <a data-link-type="dfn" href="#code-point" id="ref-for-code-point①⑤">code point</a> in the range
U+007F DELETE to U+009F APPLICATION PROGRAM COMMAND, inclusive. </p>
   <p>An <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="ascii-digit">ASCII digit</dfn> is a <a data-link-type="dfn" href="#code-point" id="ref-for-code-point①⑥">code point</a> in the range U+0030 (0) to U+0039 (9),
inclusive. </p>
   <p>An <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="ascii-upper-hex-digit">ASCII upper hex digit</dfn> is an <a data-link-type="dfn" href="#ascii-digit" id="ref-for-ascii-digit">ASCII digit</a> or a <a data-link-type="dfn" href="#code-point" id="ref-for-code-point①⑦">code point</a> in the
range U+0041 (A) to U+0046 (F), inclusive. </p>
   <p>An <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="ascii-lower-hex-digit">ASCII lower hex digit</dfn> is an <a data-link-type="dfn" href="#ascii-digit" id="ref-for-ascii-digit①">ASCII digit</a> or a <a data-link-type="dfn" href="#code-point" id="ref-for-code-point①⑧">code point</a> in the
range U+0061 (a) to U+0066 (f), inclusive. </p>
   <p>An <dfn data-dfn-type="dfn" data-export id="ascii-hex-digit">ASCII hex digit<a class="self-link" href="#ascii-hex-digit"></a></dfn> is an <a data-link-type="dfn" href="#ascii-upper-hex-digit" id="ref-for-ascii-upper-hex-digit">ASCII upper hex digit</a> or <a data-link-type="dfn" href="#ascii-lower-hex-digit" id="ref-for-ascii-lower-hex-digit">ASCII lower hex digit</a>. </p>
   <p>An <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="ascii-upper-alpha">ASCII upper alpha</dfn> is a <a data-link-type="dfn" href="#code-point" id="ref-for-code-point①⑨">code point</a> in the range U+0041 (A) to
U+005A (Z), inclusive. </p>
   <p>An <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="ascii-lower-alpha">ASCII lower alpha</dfn> is a <a data-link-type="dfn" href="#code-point" id="ref-for-code-point②⓪">code point</a> in the range U+0061 (a) to
U+007A (z), inclusive. </p>
   <p>An <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="ascii-alpha">ASCII alpha</dfn> is an <a data-link-type="dfn" href="#ascii-upper-alpha" id="ref-for-ascii-upper-alpha">ASCII upper alpha</a> or <a data-link-type="dfn" href="#ascii-lower-alpha" id="ref-for-ascii-lower-alpha">ASCII lower alpha</a>. </p>
   <p>An <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="ascii-alphanumeric">ASCII alphanumeric</dfn> is an <a data-link-type="dfn" href="#ascii-digit" id="ref-for-ascii-digit②">ASCII digit</a> or <a data-link-type="dfn" href="#ascii-alpha" id="ref-for-ascii-alpha">ASCII alpha</a>. </p>
   <h3 class="heading settled" data-level="4.6" id="strings"><span class="secno">4.6. </span><span class="content">Strings</span><a class="self-link" href="#strings"></a></h3>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="javascript-string">JavaScript string</dfn> is a sequence of unsigned 16-bit integers, also known as <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="code unit" id="code-unit">code units</dfn>. </p>
   <p class="note" role="note">This is different from how the Unicode Standard defines "code unit". In particular it
refers exclusively to how the Unicode Standard defines it for Unicode 16-bit strings. <a data-link-type="biblio" href="#biblio-unicode">[UNICODE]</a> </p>
   <p>A <a data-link-type="dfn" href="#javascript-string" id="ref-for-javascript-string">JavaScript string</a>’s <dfn data-dfn-for="JavaScript string" data-dfn-type="dfn" data-export id="javascript-string-length">length<a class="self-link" href="#javascript-string-length"></a></dfn> is the number of <a data-link-type="dfn" href="#code-unit" id="ref-for-code-unit">code units</a> it contains. </p>
   <p>A <a data-link-type="dfn" href="#javascript-string" id="ref-for-javascript-string①">JavaScript string</a> can also be interpreted as containing <a data-link-type="dfn" href="#code-point" id="ref-for-code-point②①">code points</a>, per the
conversion defined in <a data-link-type="dfn" href="https://tc39.github.io/ecma262/#sec-ecmascript-language-types-string-type" id="ref-for-sec-ecmascript-language-types-string-type">The String Type</a> section of the JavaScript specification. <a data-link-type="biblio" href="#biblio-ecma-262">[ECMA-262]</a> </p>
   <p class="note" role="note">This conversion process converts surrogate pairs into their corresponding <a data-link-type="dfn" href="#scalar-value" id="ref-for-scalar-value">scalar value</a> and maps isolated surrogates to their corresponding <a data-link-type="dfn" href="#code-point" id="ref-for-code-point②②">code point</a>, leaving
them effectively as-is. </p>
   <p class="example" id="example-javascript-string-in-code-points"><a class="self-link" href="#example-javascript-string-in-code-points"></a>A <a data-link-type="dfn" href="#javascript-string" id="ref-for-javascript-string②">JavaScript string</a> consisting
of the <a data-link-type="dfn" href="#code-unit" id="ref-for-code-unit①">code units</a> 0xD83D, 0xDCA9, and 0xD800, when interpreted as containing <a data-link-type="dfn" href="#code-point" id="ref-for-code-point②③">code points</a>, would consist of the <a data-link-type="dfn" href="#code-point" id="ref-for-code-point②④">code points</a> U+1F4A9 and U+D800. </p>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="scalar-value-string">scalar value string</dfn> is a sequence of <a data-link-type="dfn" href="#scalar-value" id="ref-for-scalar-value①">scalar values</a>. </p>
   <p class="note" role="note">A <a data-link-type="dfn" href="#scalar-value-string" id="ref-for-scalar-value-string">scalar value string</a> is useful for any kind of I/O or other kind of operation
where <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8-encode" id="ref-for-utf-8-encode①">UTF-8 encode</a> comes into play. </p>
   <p><dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="string" id="string">String</dfn> can be used to refer to either a <a data-link-type="dfn" href="#javascript-string" id="ref-for-javascript-string③">JavaScript string</a> or <a data-link-type="dfn" href="#scalar-value-string" id="ref-for-scalar-value-string①">scalar value string</a>, when it is clear from the context which is meant or when the distinction
is immaterial. <a data-link-type="dfn" href="#string" id="ref-for-string⑤">Strings</a> are denoted by double quotes and monospace font. </p>
   <p class="example" id="example-string-notation"><a class="self-link" href="#example-string-notation"></a>"<code>Hello, world!</code>" is a string. </p>
   <p>A <a data-link-type="dfn" href="#string" id="ref-for-string⑥">string</a>’s <dfn class="dfn-paneled" data-dfn-for="string" data-dfn-type="dfn" data-export id="string-length">length</dfn> is the number of <a data-link-type="dfn" href="#code-point" id="ref-for-code-point②⑤">code points</a> it
contains. </p>
   <p>To <dfn class="dfn-paneled" data-dfn-for="JavaScript string" data-dfn-type="dfn" data-export id="javascript-string-convert">convert</dfn> a <a data-link-type="dfn" href="#javascript-string" id="ref-for-javascript-string④">JavaScript string</a> into a <a data-link-type="dfn" href="#scalar-value-string" id="ref-for-scalar-value-string②">scalar value string</a>, replace any <a data-link-type="dfn" href="#surrogate" id="ref-for-surrogate①">surrogates</a> with U+FFFD. </p>
   <p class="note" role="note">The replaced surrogates are always isolated surrogates, since the process of
interpreting the JavaScript string as containing <a data-link-type="dfn" href="#code-point" id="ref-for-code-point②⑥">code points</a> will have converted surrogate
pairs into <a data-link-type="dfn" href="#scalar-value" id="ref-for-scalar-value②">scalar values</a>. </p>
   <p>A <a data-link-type="dfn" href="#scalar-value-string" id="ref-for-scalar-value-string③">scalar value string</a> can always be used as <a data-link-type="dfn" href="#javascript-string" id="ref-for-javascript-string⑤">JavaScript string</a> implicitly since it
is a subset. The reverse is only possible if the <a data-link-type="dfn" href="#javascript-string" id="ref-for-javascript-string⑥">JavaScript string</a> is known to not contain <a data-link-type="dfn" href="#surrogate" id="ref-for-surrogate②">surrogates</a>; otherwise a <a data-link-type="dfn" href="#javascript-string-convert" id="ref-for-javascript-string-convert">conversion</a> must be
performed. </p>
   <p class="note" role="note">An implementation likely has to perform explicit conversion, depending on how it
actually ends up representing <a data-link-type="dfn" href="#javascript-string" id="ref-for-javascript-string⑦">JavaScript</a> and <a data-link-type="dfn" href="#scalar-value-string" id="ref-for-scalar-value-string④">scalar value strings</a>. It is even fairly typical for implementations to have multiple
implementations of just <a data-link-type="dfn" href="#javascript-string" id="ref-for-javascript-string⑧">JavaScript strings</a> for performance and memory reasons. </p>
   <hr>
   <p>A <a data-link-type="dfn" href="#string" id="ref-for-string⑦">string</a> <var>a</var> is a <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="code unit prefix|starts with" id="code-unit-prefix">code unit prefix</dfn> of a <a data-link-type="dfn" href="#string" id="ref-for-string⑧">string</a> <var>b</var> if the following steps return true: </p>
   <ol>
    <li>
     <p>Let <var>i</var> be 0. </p>
    <li>
     <p><a data-link-type="dfn" href="#iteration-while" id="ref-for-iteration-while①">While</a> true: </p>
     <ol>
      <li>
       <p>Let <var>aCodeUnit</var> be the <var>i</var>th <a data-link-type="dfn" href="#code-unit" id="ref-for-code-unit②">code unit</a> of <var>a</var> if <var>i</var> is less than <var>a</var>’s <a data-link-type="dfn" href="#string-length" id="ref-for-string-length①">length</a>; otherwise null. </p>
      <li>
       <p>Let <var>bCodeUnit</var> be the <var>i</var>th <a data-link-type="dfn" href="#code-unit" id="ref-for-code-unit③">code unit</a> of <var>b</var> if <var>i</var> is less than <var>b</var>’s <a data-link-type="dfn" href="#string-length" id="ref-for-string-length②">length</a>; otherwise null. </p>
      <li>
       <p>If <var>bCodeUnit</var> is null, then return true. </p>
      <li>
       <p>Return false if <var>aCodeUnit</var> is different from <var>bCodeUnit</var>. </p>
      <li>
       <p>Set <var>i</var> to <var>i</var> + 1. </p>
     </ol>
   </ol>
   <p>When it is clear from context that <a data-link-type="dfn" href="#code-unit" id="ref-for-code-unit④">code units</a> are in play, e.g., because one of the
strings is a literal containing only characters that are in the range U+0020 SPACE to U+007E (~),
"<var>a</var> starts with <var>b</var>" can be used as a synonym for "<var>b</var> is a <a data-link-type="dfn" href="#code-unit-prefix" id="ref-for-code-unit-prefix">code unit prefix</a> of <var>a</var>". </p>
   <p class="example" id="code-unit-prefix-example"><a class="self-link" href="#code-unit-prefix-example"></a>With unknown values, it is good to be explicit: <var>targetString</var> is a <a data-link-type="dfn" href="#code-unit-prefix" id="ref-for-code-unit-prefix①">code unit prefix</a> of <var>userInput</var>. But with a
literal, we can use plainer language: <var>userInput</var> starts with "<code>!</code>". </p>
   <p>A <a data-link-type="dfn" href="#string" id="ref-for-string⑨">string</a> <var>a</var> is <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="code-unit-less-than">code unit less than</dfn> a <a data-link-type="dfn" href="#string" id="ref-for-string①⓪">string</a> <var>b</var> if the following steps return true: </p>
   <ol>
    <li>
     <p>If <var>b</var> is a <a data-link-type="dfn" href="#code-unit-prefix" id="ref-for-code-unit-prefix②">code unit prefix</a> of <var>a</var>, then return false. </p>
    <li>
     <p>If <var>a</var> is a <a data-link-type="dfn" href="#code-unit-prefix" id="ref-for-code-unit-prefix③">code unit prefix</a> of <var>b</var>, then return true. </p>
    <li>
     <p>Let <var>n</var> be the smallest index such that the <var>n</var>th <a data-link-type="dfn" href="#code-unit" id="ref-for-code-unit⑤">code unit</a> of <var>a</var> is different from the <var>n</var>th code unit of <var>b</var>. (There has to be such
 an index, since neither string is a prefix of the other.) </p>
    <li>
     <p>If the <var>n</var>th code unit of <var>a</var> is less than the <var>n</var>th code unit of <var>b</var>, then return true. </p>
    <li>
     <p>Return false. </p>
   </ol>
   <p class="note" role="note">This matches the ordering used by JavaScript’s <code>&lt;</code> operator, and its <code class="idl"><a data-link-type="idl" href="https://tc39.github.io/ecma262/#sec-array.prototype.sort" id="ref-for-sec-array.prototype.sort">sort()</a></code> method on an array of strings. This ordering compares the 16-bit code units in each
string, producing a highly efficient, consistent, and deterministic sort order. The resulting
ordering will not match any particular alphabet or lexicographic order, particularly for <a data-link-type="dfn" href="#code-point" id="ref-for-code-point②⑦">code points</a> represented by a surrogate pair. <a data-link-type="biblio" href="#biblio-ecma-262">[ECMA-262]</a> </p>
   <hr>
   <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="isomorphic-encode">isomorphic encode</dfn> a <a data-link-type="dfn" href="#string" id="ref-for-string①①">string</a> <var>input</var>, run these steps:</p>
   <ol>
    <li>
     <p><a data-link-type="dfn" href="#assert" id="ref-for-assert②">Assert</a>: <var>input</var> contains no <a data-link-type="dfn" href="#code-point" id="ref-for-code-point②⑧">code points</a> greater than U+00FF. </p>
    <li>
     <p>Return a <a data-link-type="dfn" href="#byte-sequence" id="ref-for-byte-sequence①②">byte sequence</a> whose <a data-link-type="dfn" href="#byte-sequence-length" id="ref-for-byte-sequence-length③">length</a> is equal to <var>input</var>’s <a data-link-type="dfn" href="#string-length" id="ref-for-string-length③">length</a> and whose <a data-link-type="dfn" href="#byte" id="ref-for-byte⑨">bytes</a> have the same values as <var>input</var>’s <a data-link-type="dfn" href="#code-point" id="ref-for-code-point②⑨">code points</a>, in the same order. </p>
   </ol>
   <hr>
   <p>An <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="ascii-string">ASCII string</dfn> is a <a data-link-type="dfn" href="#string" id="ref-for-string①②">string</a> whose <a data-link-type="dfn" href="#code-point" id="ref-for-code-point③⓪">code points</a> are all <a data-link-type="dfn" href="#ascii-code-point" id="ref-for-ascii-code-point">ASCII code points</a>. </p>
   <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="ascii-lowercase">ASCII lowercase</dfn> a <a data-link-type="dfn" href="#string" id="ref-for-string①③">string</a>, replace all <a data-link-type="dfn" href="#ascii-upper-alpha" id="ref-for-ascii-upper-alpha①">ASCII upper alphas</a> in
the <a data-link-type="dfn" href="#string" id="ref-for-string①④">string</a> with their corresponding <a data-link-type="dfn" href="#code-point" id="ref-for-code-point③①">code point</a> in <a data-link-type="dfn" href="#ascii-lower-alpha" id="ref-for-ascii-lower-alpha①">ASCII lower alpha</a>. </p>
   <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="ascii-uppercase">ASCII uppercase</dfn> a <a data-link-type="dfn" href="#string" id="ref-for-string①⑤">string</a>, replace all <a data-link-type="dfn" href="#ascii-lower-alpha" id="ref-for-ascii-lower-alpha②">ASCII lower alphas</a> in
the <a data-link-type="dfn" href="#string" id="ref-for-string①⑥">string</a> with their corresponding <a data-link-type="dfn" href="#code-point" id="ref-for-code-point③②">code point</a> in <a data-link-type="dfn" href="#ascii-upper-alpha" id="ref-for-ascii-upper-alpha②">ASCII upper alpha</a>. </p>
   <p>A <a data-link-type="dfn" href="#string" id="ref-for-string①⑦">string</a> <var>A</var> is an <dfn data-dfn-type="dfn" data-export id="ascii-case-insensitive">ASCII case-insensitive<a class="self-link" href="#ascii-case-insensitive"></a></dfn> match for a <a data-link-type="dfn" href="#string" id="ref-for-string①⑧">string</a> <var>B</var>, if the <a data-link-type="dfn" href="#ascii-lowercase" id="ref-for-ascii-lowercase">ASCII lowercase</a> of <var>A</var> is the <a data-link-type="dfn" href="#ascii-lowercase" id="ref-for-ascii-lowercase①">ASCII lowercase</a> of <var>B</var>. </p>
   <p>To <dfn data-dfn-type="dfn" data-export id="ascii-encode">ASCII encode<a class="self-link" href="#ascii-encode"></a></dfn> a <a data-link-type="dfn" href="#string" id="ref-for-string①⑨">string</a> <var>input</var>, run these steps: </p>
   <ol>
    <li>
     <p><a data-link-type="dfn" href="#assert" id="ref-for-assert③">Assert</a>: <var>input</var> is an <a data-link-type="dfn" href="#ascii-string" id="ref-for-ascii-string">ASCII string</a>. </p>
     <p class="note" role="note">Note: This precondition ensures that <a data-link-type="dfn" href="#isomorphic-encode" id="ref-for-isomorphic-encode①">isomorphic encode</a> and <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8-encode" id="ref-for-utf-8-encode②">UTF-8 encode</a> return the same <a data-link-type="dfn" href="#byte-sequence" id="ref-for-byte-sequence①③">byte sequence</a> for this input. </p>
    <li>
     <p>Return the <a data-link-type="dfn" href="#isomorphic-encode" id="ref-for-isomorphic-encode②">isomorphic encoding</a> of <var>input</var>. </p>
   </ol>
   <p>To <dfn data-dfn-type="dfn" data-export id="ascii-decode">ASCII decode<a class="self-link" href="#ascii-decode"></a></dfn> a <a data-link-type="dfn" href="#byte-sequence" id="ref-for-byte-sequence①④">byte sequence</a> <var>input</var>, run these steps: </p>
   <ol>
    <li>
     <p><a data-link-type="dfn" href="#assert" id="ref-for-assert④">Assert</a>: All bytes in <var>input</var> are <a data-link-type="dfn" href="#ascii-byte" id="ref-for-ascii-byte①">ASCII bytes</a>. </p>
     <p class="note" role="note">Note: This precondition ensures that <a data-link-type="dfn" href="#isomorphic-decode" id="ref-for-isomorphic-decode">isomorphic decode</a> and <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8-decode" id="ref-for-utf-8-decode②">UTF-8 decode</a> return the same <a data-link-type="dfn" href="#string" id="ref-for-string②⓪">string</a> for this input. </p>
    <li>
     <p>Return the <a data-link-type="dfn" href="#isomorphic-decode" id="ref-for-isomorphic-decode①">isomorphic decoding</a> of <var>input</var>. </p>
   </ol>
   <hr>
   <p>To <dfn data-dfn-type="dfn" data-export id="strip-newlines">strip newlines<a class="self-link" href="#strip-newlines"></a></dfn> from a <a data-link-type="dfn" href="#string" id="ref-for-string②①">string</a>, remove any U+000A LF and U+000D CR <a data-link-type="dfn" href="#code-point" id="ref-for-code-point③③">code points</a> from the <a data-link-type="dfn" href="#string" id="ref-for-string②②">string</a>. </p>
   <p>To <dfn data-dfn-type="dfn" data-export id="normalize-newlines">normalize newlines<a class="self-link" href="#normalize-newlines"></a></dfn> in a <a data-link-type="dfn" href="#string" id="ref-for-string②③">string</a>, replace every U+000D CR U+000A LF <a data-link-type="dfn" href="#code-point" id="ref-for-code-point③④">code point</a> pair with a single U+000A LF <a data-link-type="dfn" href="#code-point" id="ref-for-code-point③⑤">code point</a>, and then replace every remaining
U+000D CR <a data-link-type="dfn" href="#code-point" id="ref-for-code-point③⑥">code point</a> with a U+000A LF <a data-link-type="dfn" href="#code-point" id="ref-for-code-point③⑦">code point</a>. </p>
   <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="strip-leading-and-trailing-ascii-whitespace">strip leading and trailing ASCII whitespace</dfn> from a <a data-link-type="dfn" href="#string" id="ref-for-string②④">string</a>, remove all <a data-link-type="dfn" href="#ascii-whitespace" id="ref-for-ascii-whitespace">ASCII whitespace</a> that are at the start or the end of the <a data-link-type="dfn" href="#string" id="ref-for-string②⑤">string</a>. </p>
   <p>To <dfn data-dfn-type="dfn" data-export id="strip-and-collapse-ascii-whitespace">strip and collapse ASCII whitespace<a class="self-link" href="#strip-and-collapse-ascii-whitespace"></a></dfn> in a <a data-link-type="dfn" href="#string" id="ref-for-string②⑥">string</a>, replace any sequence
of one or more consecutive <a data-link-type="dfn" href="#code-point" id="ref-for-code-point③⑧">code points</a> that are <a data-link-type="dfn" href="#ascii-whitespace" id="ref-for-ascii-whitespace①">ASCII whitespace</a> in the <a data-link-type="dfn" href="#string" id="ref-for-string②⑦">string</a> with a single U+0020 SPACE <a data-link-type="dfn" href="#code-point" id="ref-for-code-point③⑨">code point</a>, and then remove any leading and trailing <a data-link-type="dfn" href="#ascii-whitespace" id="ref-for-ascii-whitespace②">ASCII whitespace</a> from that string. </p>
   <hr>
   <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="collect a sequence of code points|collecting a sequence of code
points" id="collect-a-sequence-of-code-points">collect a sequence of <a data-link-type="dfn" href="#code-point" id="ref-for-code-point④⓪">code points</a></dfn> meeting a condition <var>condition</var> from
a <a data-link-type="dfn" href="#string" id="ref-for-string②⑧">string</a> <var>input</var>, given a <dfn class="dfn-paneled" data-dfn-for="string" data-dfn-type="dfn" data-export id="string-position-variable">position variable</dfn> <var>position</var> tracking the position of the calling algorithm within <var>input</var>:</p>
   <ol>
    <li>
     <p>Let <var>result</var> be the empty <a data-link-type="dfn" href="#string" id="ref-for-string②⑨">string</a>. </p>
    <li>
     <p>While <var>position</var> doesn’t point past the end of <var>input</var> and the <a data-link-type="dfn" href="#code-point" id="ref-for-code-point④①">code point</a> at <var>position</var> within <var>input</var> meets the condition <var>condition</var>: </p>
     <ol>
      <li>
       <p>Append that <a data-link-type="dfn" href="#code-point" id="ref-for-code-point④②">code point</a> to the end of <var>result</var>. </p>
      <li>
       <p>Advance <var>position</var> by 1. </p>
     </ol>
    <li>
     <p>Return <var>result</var>. </p>
   </ol>
   <p class="note" role="note">In addition to returning the collected <a data-link-type="dfn" href="#code-point" id="ref-for-code-point④③">code points</a>, this algorithm updates the <a data-link-type="dfn" href="#string-position-variable" id="ref-for-string-position-variable">position variable</a> in the calling algorithm. </p>
   <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="skip-ascii-whitespace">skip ASCII whitespace</dfn> within a <a data-link-type="dfn" href="#string" id="ref-for-string③⓪">string</a> <var>input</var> given a <a data-link-type="dfn" href="#string-position-variable" id="ref-for-string-position-variable①">position variable</a> <var>position</var>, <a data-link-type="dfn" href="#collect-a-sequence-of-code-points" id="ref-for-collect-a-sequence-of-code-points">collect a sequence of code points</a> that are <a data-link-type="dfn" href="#ascii-whitespace" id="ref-for-ascii-whitespace③">ASCII whitespace</a> from <var>input</var> given <var>position</var>. The collected <a data-link-type="dfn" href="#code-point" id="ref-for-code-point④④">code points</a> are not used, but <var>position</var> is still updated. </p>
   <hr>
   <p>To <dfn data-dfn-type="dfn" data-export data-lt="strictly split|strictly split a string" id="strictly-split">strictly split a <a data-link-type="dfn" href="#string" id="ref-for-string③①">string</a><a class="self-link" href="#strictly-split"></a></dfn> <var>input</var> on a particular delimiter <a data-link-type="dfn" href="#code-point" id="ref-for-code-point④⑤">code point</a> <var>delimiter</var>:</p>
   <ol>
    <li>
     <p>Let <var>position</var> be a <a data-link-type="dfn" href="#string-position-variable" id="ref-for-string-position-variable②">position variable</a> for <var>input</var>, initially
 pointing at the start of <var>input</var>. </p>
    <li>
     <p>Let <var>tokens</var> be a <a data-link-type="dfn" href="#list" id="ref-for-list④">list</a> of <a data-link-type="dfn" href="#string" id="ref-for-string③②">strings</a>, initially empty. </p>
    <li>
     <p>Let <var>token</var> be the result of <a data-link-type="dfn" href="#collect-a-sequence-of-code-points" id="ref-for-collect-a-sequence-of-code-points①">collecting a sequence of code points</a> that are
 not equal to <var>delimiter</var> from <var>input</var>, given <var>position</var>. </p>
    <li>
     <p><a data-link-type="dfn" href="#list-append" id="ref-for-list-append⑧">Append</a> <var>token</var> to <var>tokens</var>. </p>
    <li>
     <p>While <var>position</var> is not past the end of <var>input</var>: </p>
     <ol>
      <li>
       <p><a data-link-type="dfn" href="#assert" id="ref-for-assert⑤">Assert</a>: the <a data-link-type="dfn" href="#code-point" id="ref-for-code-point④⑥">code point</a> at <var>position</var> within <var>input</var> is <var>delimiter</var>. </p>
      <li>
       <p>Advance <var>position</var> by 1. </p>
      <li>
       <p>Let <var>token</var> be the result of <a data-link-type="dfn" href="#collect-a-sequence-of-code-points" id="ref-for-collect-a-sequence-of-code-points②">collecting a sequence of code points</a> that are
   not equal to <var>delimiter</var> from <var>input</var>, given <var>position</var>. </p>
      <li>
       <p><a data-link-type="dfn" href="#list-append" id="ref-for-list-append⑨">Append</a> <var>token</var> to <var>tokens</var>. </p>
     </ol>
    <li>
     <p>Return <var>tokens</var>. </p>
   </ol>
   <p class="note" role="note">This algorithm is a "strict" split, as opposed to the commonly-used variants <a data-link-type="dfn" href="#split-on-ascii-whitespace" id="ref-for-split-on-ascii-whitespace">for ASCII whitespace</a> and <a data-link-type="dfn" href="#split-on-commas" id="ref-for-split-on-commas">for commas</a> below, which are both more lenient in various ways involving
interspersed <a data-link-type="dfn" href="#ascii-whitespace" id="ref-for-ascii-whitespace④">ASCII whitespace</a>. </p>
   <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="split on ASCII whitespace|split a string on ASCII whitespace" id="split-on-ascii-whitespace">split a <a data-link-type="dfn" href="#string" id="ref-for-string③③">string</a> <var>input</var> on ASCII whitespace</dfn>: </p>
   <ol>
    <li>
     <p>Let <var>position</var> be a <a data-link-type="dfn" href="#string-position-variable" id="ref-for-string-position-variable③">position variable</a> for <var>input</var>, initially
 pointing at the start of <var>input</var>. </p>
    <li>
     <p>Let <var>tokens</var> be a <a data-link-type="dfn" href="#list" id="ref-for-list⑤">list</a> of <a data-link-type="dfn" href="#string" id="ref-for-string③④">strings</a>, initially empty. </p>
    <li>
     <p><a data-link-type="dfn" href="#skip-ascii-whitespace" id="ref-for-skip-ascii-whitespace">Skip ASCII whitespace</a> within <var>input</var> given <var>position</var>. </p>
    <li>
     <p>While <var>position</var> is not past the end of <var>input</var>: </p>
     <ol>
      <li>
       <p>Let <var>token</var> be the result of <a data-link-type="dfn" href="#collect-a-sequence-of-code-points" id="ref-for-collect-a-sequence-of-code-points③">collecting a sequence of code points</a> that are
   not <a data-link-type="dfn" href="#ascii-whitespace" id="ref-for-ascii-whitespace⑤">ASCII whitespace</a> from <var>input</var>, given <var>position</var>. </p>
      <li>
       <p><a data-link-type="dfn" href="#list-append" id="ref-for-list-append①⓪">Append</a> <var>token</var> to <var>tokens</var>. </p>
      <li>
       <p><a data-link-type="dfn" href="#skip-ascii-whitespace" id="ref-for-skip-ascii-whitespace①">Skip ASCII whitespace</a> within <var>input</var> given <var>position</var>. </p>
     </ol>
    <li>
     <p>Return <var>tokens</var>. </p>
   </ol>
   <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="split on commas|split a string on commas" id="split-on-commas">split a <a data-link-type="dfn" href="#string" id="ref-for-string③⑤">string</a> <var>input</var> on commas</dfn>: </p>
   <ol>
    <li>
     <p>Let <var>position</var> be a <a data-link-type="dfn" href="#string-position-variable" id="ref-for-string-position-variable④">position variable</a> for <var>input</var>, initially
 pointing at the start of <var>input</var>. </p>
    <li>
     <p>Let <var>tokens</var> be a <a data-link-type="dfn" href="#list" id="ref-for-list⑥">list</a> of <a data-link-type="dfn" href="#string" id="ref-for-string③⑥">strings</a>, initially empty. </p>
    <li>
     <p>While <var>position</var> is not past the end of <var>input</var>: </p>
     <ol>
      <li>
       <p>Let <var>token</var> be the result of <a data-link-type="dfn" href="#collect-a-sequence-of-code-points" id="ref-for-collect-a-sequence-of-code-points④">collecting a sequence of code points</a> that are
    not U+002C (,) from <var>input</var>, given <var>position</var>. </p>
       <p class="note" role="note"><var>token</var> might be the empty string. </p>
      <li><a data-link-type="dfn" href="#strip-leading-and-trailing-ascii-whitespace" id="ref-for-strip-leading-and-trailing-ascii-whitespace">Strip leading and trailing ASCII whitespace</a> from <var>token</var>. 
      <li>
       <p><a data-link-type="dfn" href="#list-append" id="ref-for-list-append①①">Append</a> <var>token</var> to <var>tokens</var>. </p>
      <li>
       <p>If <var>position</var> is not past the end of <var>input</var>, then: </p>
       <ol>
        <li>
         <p><a data-link-type="dfn" href="#assert" id="ref-for-assert⑥">Assert</a>: the <a data-link-type="dfn" href="#code-point" id="ref-for-code-point④⑦">code point</a> at <var>position</var> within <var>input</var> is
     U+002C (,). </p>
        <li>
         <p>Advance <var>position</var> by 1. </p>
       </ol>
     </ol>
    <li>
     <p>Return <var>tokens</var>. </p>
   </ol>
   <p>To <dfn class="dfn-paneled" data-dfn-for="string" data-dfn-type="dfn" data-export data-lt="concatenate|concatenation" id="string-concatenate">concatenate</dfn> a <a data-link-type="dfn" href="#list" id="ref-for-list⑦">list</a> of <a data-link-type="dfn" href="#string" id="ref-for-string③⑦">strings</a> <var>list</var>, using an optional separator string <var>separator</var>, run
these steps: </p>
   <ol>
    <li>
     <p>If <var>list</var> <a data-link-type="dfn" href="#list-is-empty" id="ref-for-list-is-empty">is empty</a>, then return the empty string. </p>
    <li>
     <p>If <var>separator</var> is not given, then set <var>separator</var> to the empty string. </p>
    <li>
     <p>Return a <a data-link-type="dfn" href="#string" id="ref-for-string③⑧">string</a> whose contents are <var>list</var>’s <a data-link-type="dfn" href="#list-item" id="ref-for-list-item">items</a>, in
 order, separated from each other by <var>separator</var>. </p>
   </ol>
   <p class="example" id="example-string-concatenate"><a class="self-link" href="#example-string-concatenate"></a>To serialize a set <var>set</var>, return the <a data-link-type="dfn" href="#string-concatenate" id="ref-for-string-concatenate">concatenation</a> of <var>set</var> using U+0020 SPACE. </p>
   <h2 class="heading settled" data-level="5" id="data-structures"><span class="secno">5. </span><span class="content">Data structures</span><a class="self-link" href="#data-structures"></a></h2>
   <p>Conventionally, specifications have operated on a variety of vague specification-level data
structures, based on shared understanding of their semantics. This generally works well, but can
lead to ambiguities around edge cases, such as iteration order or what happens when you <a data-link-type="dfn" href="#set-append" id="ref-for-set-append">append</a> an <a data-link-type="dfn" href="#list-item" id="ref-for-list-item①">item</a> to an <a data-link-type="dfn" href="#ordered-set" id="ref-for-ordered-set">ordered set</a> that the set already <a data-link-type="dfn" href="#list-contain" id="ref-for-list-contain">contains</a>. It has also led to a variety of divergent notation and phrasing, especially
around more complex data structures such as <a data-link-type="dfn" href="#ordered-map" id="ref-for-ordered-map">maps</a>. </p>
   <p>This standard provides a small set of common data structures, along with notation and phrasing
for working with them, in order to create common ground. </p>
   <h3 class="heading settled" data-level="5.1" id="lists"><span class="secno">5.1. </span><span class="content">Lists</span><a class="self-link" href="#lists"></a></h3>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="list">list</dfn> is a specification type consisting of a finite ordered sequence of <dfn class="dfn-paneled" data-dfn-for="list,stack,queue,set" data-dfn-type="dfn" data-export data-lt="item" id="list-item">items</dfn>. </p>
   <p>For notational convenience, a literal syntax can be used to express <a data-link-type="dfn" href="#list" id="ref-for-list⑧">lists</a>, by surrounding
the list by « » characters and separating its <a data-link-type="dfn" href="#list-item" id="ref-for-list-item②">items</a> with a comma. An indexing syntax
can be used by providing a zero-based index into a list inside square brackets. The index cannot be
out-of-bounds, except when used with <a data-link-type="dfn" href="#list-contain" id="ref-for-list-contain①">exists</a>. </p>
   <p class="example" id="example-list-notation"><a class="self-link" href="#example-list-notation"></a>Let <var>example</var> be the <a data-link-type="dfn" href="#list" id="ref-for-list⑨">list</a> « "<code>a</code>",
"<code>b</code>", "<code>c</code>", "<code>a</code>" ». Then <var>example</var>[1] is the <a data-link-type="dfn" href="#string" id="ref-for-string③⑨">string</a> "<code>b</code>". </p>
   <hr>
   <p>To <dfn class="dfn-paneled" data-dfn-for="list" data-dfn-type="dfn" data-export id="list-append">append</dfn> to a <a data-link-type="dfn" href="#list" id="ref-for-list①⓪">list</a> that is not an <a data-link-type="dfn" href="#ordered-set" id="ref-for-ordered-set①">ordered set</a> is to
add the given <a data-link-type="dfn" href="#list-item" id="ref-for-list-item③">item</a> to the end of the list. </p>
   <p>To <dfn class="dfn-paneled" data-dfn-for="list" data-dfn-type="dfn" data-export id="list-extend">extend</dfn> a <a data-link-type="dfn" href="#list" id="ref-for-list①①">list</a> <var>A</var> with a <a data-link-type="dfn" href="#list" id="ref-for-list①②">list</a> <var>B</var>, <a data-link-type="dfn" href="#list-iterate" id="ref-for-list-iterate④">for each</a> <var>item</var> of <var>B</var>, <a data-link-type="dfn" href="#list-append" id="ref-for-list-append①②">append</a> <var>item</var> to <var>A</var>. </p>
   <div class="example" id="example-list-extend">
    <a class="self-link" href="#example-list-extend"></a> 
    <ol>
     <li>
      <p>Let <var>ghostbusters</var> be « "<code>Erin Gilbert</code>", "<code>Abby Yates</code>" ». </p>
     <li>
      <p><a data-link-type="dfn" href="#list-extend" id="ref-for-list-extend">Extend</a> <var>ghostbusters</var> with « "<code>Jillian Holtzmann</code>",
  "<code>Patty Tolan</code>" ». </p>
     <li>
      <p><a data-link-type="dfn" href="#assert" id="ref-for-assert⑦">Assert</a>: <var>ghostbusters</var>’s <a data-link-type="dfn" href="#list-size" id="ref-for-list-size">size</a> is 4. </p>
     <li>
      <p><a data-link-type="dfn" href="#assert" id="ref-for-assert⑧">Assert</a>: <var>ghostbusters</var>[2] is "<code>Jillian Holtzmann</code>". </p>
    </ol>
   </div>
   <p>To <dfn class="dfn-paneled" data-dfn-for="list" data-dfn-type="dfn" data-export id="list-prepend">prepend</dfn> to a <a data-link-type="dfn" href="#list" id="ref-for-list①③">list</a> that is not an <a data-link-type="dfn" href="#ordered-set" id="ref-for-ordered-set②">ordered set</a> is to
add the given <a data-link-type="dfn" href="#list-item" id="ref-for-list-item④">item</a> to the beginning of the list. </p>
   <p>To <dfn data-dfn-for="list" data-dfn-type="dfn" data-export id="list-replace">replace<a class="self-link" href="#list-replace"></a></dfn> within a <a data-link-type="dfn" href="#list" id="ref-for-list①④">list</a> that is not an <a data-link-type="dfn" href="#ordered-set" id="ref-for-ordered-set③">ordered set</a> is
to replace all items from the list that match a given condition with the given <a data-link-type="dfn" href="#list-item" id="ref-for-list-item⑤">item</a>,
or do nothing if none do. </p>
   <p class="note" role="note">The above definitions are modified when the <a data-link-type="dfn" href="#list" id="ref-for-list①⑤">list</a> is an <a data-link-type="dfn" href="#ordered-set" id="ref-for-ordered-set④">ordered set</a>; see
below for <a data-link-type="dfn" href="#set-append" id="ref-for-set-append①">ordered set append</a>, <a data-link-type="dfn" href="#set-prepend" id="ref-for-set-prepend">prepend</a>, and <a data-link-type="dfn" href="#set-replace" id="ref-for-set-replace">replace</a>. </p>
   <p>To <dfn data-dfn-for="list,set" data-dfn-type="dfn" data-export id="list-insert">insert<a class="self-link" href="#list-insert"></a></dfn> an <a data-link-type="dfn" href="#list-item" id="ref-for-list-item⑥">item</a> into a <a data-link-type="dfn" href="#list" id="ref-for-list①⑥">list</a> before an
index is to add the given item to the list between the given index − 1 and the given index. If
the given index is 0, then <a data-link-type="dfn" href="#list-prepend" id="ref-for-list-prepend">prepend</a> the given item to the list. </p>
   <p>To <dfn class="dfn-paneled" data-dfn-for="list,set" data-dfn-type="dfn" data-export id="list-remove">remove</dfn> zero or more <a data-link-type="dfn" href="#list-item" id="ref-for-list-item⑦">items</a> from a <a data-link-type="dfn" href="#list" id="ref-for-list①⑦">list</a> is
to remove all items from the list that match a given condition, or do nothing if none do. </p>
   <div class="example" id="example-list-remove">
    <a class="self-link" href="#example-list-remove"></a> 
    <p><a data-link-type="dfn" href="#list-remove" id="ref-for-list-remove">Removing</a> <var>x</var> from the <a data-link-type="dfn" href="#list" id="ref-for-list①⑧">list</a> « <var>x</var>, <var>y</var>, <var>z</var>, <var>x</var> » is to remove all
 items from the list that are equal to <var>x</var>. The list now is equivalent to « <var>y</var>, <var>z</var> ». </p>
    <p><a data-link-type="dfn" href="#list-remove" id="ref-for-list-remove①">Removing</a> all items that start with the <a data-link-type="dfn" href="#string" id="ref-for-string④⓪">string</a> "<code>a</code>" from the <a data-link-type="dfn" href="#list" id="ref-for-list①⑨">list</a> « "<code>a</code>", "<code>b</code>", "<code>ab</code>", "<code>ba</code>" » is to
 remove the items "<code>a</code>" and "<code>ab</code>". The list is now equivalent to «
 "<code>b</code>", "<code>ba</code>" ». </p>
   </div>
   <p>To <dfn data-dfn-for="list,stack,queue,set" data-dfn-type="dfn" data-export id="list-empty">empty<a class="self-link" href="#list-empty"></a></dfn> a <a data-link-type="dfn" href="#list" id="ref-for-list②⓪">list</a> is to <a data-link-type="dfn" href="#list-remove" id="ref-for-list-remove②">remove</a> all of its <a data-link-type="dfn" href="#list-item" id="ref-for-list-item⑧">items</a>. </p>
   <p>A <a data-link-type="dfn" href="#list" id="ref-for-list②①">list</a> <dfn class="dfn-paneled" data-dfn-for="list,stack,queue,set" data-dfn-type="dfn" data-export data-lt="contain|exist" id="list-contain">contains</dfn> an <a data-link-type="dfn" href="#list-item" id="ref-for-list-item⑨">item</a> if it appears in the list. We can also denote this by saying that, for a <a data-link-type="dfn" href="#list" id="ref-for-list②②">list</a> <var>list</var> and an index <var>index</var>, "<var>list</var>[<var>index</var>] <a data-link-type="dfn" href="#list-contain" id="ref-for-list-contain②">exists</a>". </p>
   <p>A <a data-link-type="dfn" href="#list" id="ref-for-list②③">list</a>’s <dfn class="dfn-paneled" data-dfn-for="list,stack,queue,set" data-dfn-type="dfn" data-export id="list-size">size</dfn> is the number of <a data-link-type="dfn" href="#list-item" id="ref-for-list-item①⓪">items</a> the list <a data-link-type="dfn" href="#list-contain" id="ref-for-list-contain③">contains</a>. </p>
   <p>A <a data-link-type="dfn" href="#list" id="ref-for-list②④">list</a> <dfn class="dfn-paneled" data-dfn-for="list,stack,queue,set" data-dfn-type="dfn" data-export data-lt="is empty|is not empty" id="list-is-empty">is empty</dfn> if
its <a data-link-type="dfn" href="#list-size" id="ref-for-list-size①">size</a> is zero. </p>
   <p>To <dfn class="dfn-paneled" data-dfn-for="list,set" data-dfn-type="dfn" data-export data-lt="iterate|for each" id="list-iterate">iterate</dfn> over a <a data-link-type="dfn" href="#list" id="ref-for-list②⑤">list</a>, performing a
set of steps on each <a data-link-type="dfn" href="#list-item" id="ref-for-list-item①①">item</a> in order, use phrasing of the form
"<a data-link-type="dfn" href="#list-iterate" id="ref-for-list-iterate⑤">For each</a> <var>item</var> of <var>list</var>", and then operate on <var>item</var> in the
subsequent prose. </p>
   <p>To <dfn class="dfn-paneled" data-dfn-for="list,stack,queue,set" data-dfn-type="dfn" data-export id="list-clone">clone</dfn> a <a data-link-type="dfn" href="#list" id="ref-for-list②⑥">list</a> <var>list</var> is to create a new <a data-link-type="dfn" href="#list" id="ref-for-list②⑦">list</a> <var>clone</var>, of the same designation, and, <a data-link-type="dfn" href="#list-iterate" id="ref-for-list-iterate⑥">for each</a> <var>item</var> of <var>list</var>, <a data-link-type="dfn" href="#list-append" id="ref-for-list-append①③">append</a> <var>item</var> to <var>clone</var>, so that <var>clone</var> <a data-link-type="dfn" href="#list-contain" id="ref-for-list-contain④">contains</a> the same <a data-link-type="dfn" href="#list-item" id="ref-for-list-item①②">items</a>, in the same order as <var>list</var>. </p>
   <p class="note" role="note">This is a "shallow clone", as the <a data-link-type="dfn" href="#list-item" id="ref-for-list-item①③">items</a> themselves are not cloned in
any way. </p>
   <p class="example" id="example-list-clone"><a class="self-link" href="#example-list-clone"></a>Let <var>original</var> be the <a data-link-type="dfn" href="#ordered-set" id="ref-for-ordered-set⑤">ordered set</a> «
"<code>a</code>", "<code>b</code>", "<code>c</code>" ». <a data-link-type="dfn" href="#list-clone" id="ref-for-list-clone">Cloning</a> <var>original</var> creates
a new <a data-link-type="dfn" href="#ordered-set" id="ref-for-ordered-set⑥">ordered set</a> <var>clone</var>, so that <a data-link-type="dfn" href="#set-replace" id="ref-for-set-replace①">replacing</a> "<code>a</code>" with
"<code>foo</code>" in <var>clone</var> gives « "<code>foo</code>", "<code>b</code>", "<code>c</code>" »,
while <var>original</var>[0] is still the <a data-link-type="dfn" href="#string" id="ref-for-string④①">string</a> "<code>a</code>". </p>
   <p>To <dfn class="dfn-paneled" data-dfn-for="list,stack,queue,set" data-dfn-type="dfn" data-export data-lt="sort in ascending order|sorting in ascending order|sort|sorting" id="list-sort-in-ascending-order">sort in ascending order</dfn> a <a data-link-type="dfn" href="#list" id="ref-for-list②⑧">list</a> <var>list</var>, with a less than algorithm <var>lessThanAlgo</var>, is to create a new <a data-link-type="dfn" href="#list" id="ref-for-list②⑨">list</a> <var>sorted</var>, containing the same <a data-link-type="dfn" href="#list-item" id="ref-for-list-item①④">items</a> as <var>list</var> but sorted so that according to <var>lessThanAlgo</var>, each item is less than the one following it, if any. For items that sort the same
(i.e., for which <var>lessThanAlgo</var> returns false for both comparisons), their relative order in <var>sorted</var> must be the same as it was in <var>list</var>. </p>
   <p>To <dfn data-dfn-for="list,stack,queue,set" data-dfn-type="dfn" data-export data-lt="sort in descending order|sorting in descending order" id="list-sort-in-descending-order">sort in descending order<a class="self-link" href="#list-sort-in-descending-order"></a></dfn> a <a data-link-type="dfn" href="#list" id="ref-for-list③⓪">list</a> <var>list</var>, with a less than algorithm <var>lessThanAlgo</var>, is to create a new <a data-link-type="dfn" href="#list" id="ref-for-list③①">list</a> <var>sorted</var>, containing the same <a data-link-type="dfn" href="#list-item" id="ref-for-list-item①⑤">items</a> as <var>list</var> but sorted so that according to <var>lessThanAlgo</var>, each item is less than the one preceding it, if any. For items that sort the same
(i.e., for which <var>lessThanAlgo</var> returns false for both comparisons), their relative order in <var>sorted</var> must be the same as it was in <var>list</var>. </p>
   <p class="example" id="example-list-sort"><a class="self-link" href="#example-list-sort"></a>Let <var>original</var> be the <a data-link-type="dfn" href="#list" id="ref-for-list③②">list</a> « (200, "<code>OK</code>"),
(404, "<code>Not Found</code>"), (null, "<code>OK</code>") ». <a data-link-type="dfn" href="#list-sort-in-ascending-order" id="ref-for-list-sort-in-ascending-order">Sorting</a> <var>original</var> in
ascending order, with <var>a</var> being less than <var>b</var> if <var>a</var>’s second <a data-link-type="dfn" href="#struct-item" id="ref-for-struct-item">item</a> is <a data-link-type="dfn" href="#code-unit-less-than" id="ref-for-code-unit-less-than">code unit less than</a> <var>b</var>’s second <a data-link-type="dfn" href="#struct-item" id="ref-for-struct-item①">item</a>, gives the result « (404,
"<code>Not Found</code>"), (200, "<code>OK</code>"), (null, "<code>OK</code>") ».</p>
   <hr>
   <p>The <a data-link-type="dfn" href="#list" id="ref-for-list③③">list</a> type originates from the JavaScript specification (where it is capitalized, as <a data-link-type="dfn" href="https://tc39.github.io/ecma262/#sec-list-and-record-specification-type" id="ref-for-sec-list-and-record-specification-type">List</a>); we repeat some elements of its definition here for ease of reference,
and provide an expanded vocabulary for manipulating <a data-link-type="dfn" href="#list" id="ref-for-list③④">lists</a>. Whenever JavaScript expects a <a data-link-type="dfn" href="https://tc39.github.io/ecma262/#sec-list-and-record-specification-type" id="ref-for-sec-list-and-record-specification-type①">List</a>, a <a data-link-type="dfn" href="#list" id="ref-for-list③⑤">list</a> as defined here can be used; they are the same type. <a data-link-type="biblio" href="#biblio-ecma-262">[ECMA-262]</a> </p>
   <h4 class="heading settled" data-level="5.1.1" id="stacks"><span class="secno">5.1.1. </span><span class="content">Stacks</span><a class="self-link" href="#stacks"></a></h4>
   <p>Some <a data-link-type="dfn" href="#list" id="ref-for-list③⑥">lists</a> are designated as <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="stack" id="stack">stacks</dfn>. A stack is a <a data-link-type="dfn" href="#list" id="ref-for-list③⑦">list</a>,
but conventionally, the following operations are used to operate on it, instead of using <a data-link-type="dfn" href="#list-append" id="ref-for-list-append①④">append</a>, <a data-link-type="dfn" href="#list-prepend" id="ref-for-list-prepend①">prepend</a>, or <a data-link-type="dfn" href="#list-remove" id="ref-for-list-remove③">remove</a>. </p>
   <p>To <dfn data-dfn-for="stack" data-dfn-type="dfn" data-export id="stack-push">push<a class="self-link" href="#stack-push"></a></dfn> onto a <a data-link-type="dfn" href="#stack" id="ref-for-stack">stack</a> is to <a data-link-type="dfn" href="#list-append" id="ref-for-list-append①⑤">append</a> to it. </p>
   <p>To <dfn class="dfn-paneled" data-dfn-for="stack" data-dfn-type="dfn" data-export id="stack-pop">pop</dfn> from a <a data-link-type="dfn" href="#stack" id="ref-for-stack①">stack</a>: if the <a data-link-type="dfn" href="#stack" id="ref-for-stack②">stack</a> <a data-link-type="dfn" href="#list-is-empty" id="ref-for-list-is-empty①">is not empty</a>, then <a data-link-type="dfn" href="#list-remove" id="ref-for-list-remove④">remove</a> its last <a data-link-type="dfn" href="#list-item" id="ref-for-list-item①⑥">item</a> and return
it; otherwise, return nothing. </p>
   <p>Although <a data-link-type="dfn" href="#stack" id="ref-for-stack③">stacks</a> are <a data-link-type="dfn" href="#list" id="ref-for-list③⑧">lists</a>, <a data-link-type="dfn" href="#list-iterate" id="ref-for-list-iterate⑦">for each</a> must not be used with them;
instead, a combination of <a data-link-type="dfn" href="#iteration-while" id="ref-for-iteration-while②">while</a> and <a data-link-type="dfn" href="#stack-pop" id="ref-for-stack-pop">pop</a> is more appropriate. </p>
   <h4 class="heading settled" data-level="5.1.2" id="queues"><span class="secno">5.1.2. </span><span class="content">Queues</span><a class="self-link" href="#queues"></a></h4>
   <p>Some <a data-link-type="dfn" href="#list" id="ref-for-list③⑨">lists</a> are designated as <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="queue" id="queue">queues</dfn>. A queue is a <a data-link-type="dfn" href="#list" id="ref-for-list④⓪">list</a>,
but conventionally, the following operations are used to operate on it, instead of using <a data-link-type="dfn" href="#list-append" id="ref-for-list-append①⑥">append</a>, <a data-link-type="dfn" href="#list-prepend" id="ref-for-list-prepend②">prepend</a>, or <a data-link-type="dfn" href="#list-remove" id="ref-for-list-remove⑤">remove</a>. </p>
   <p>To <dfn data-dfn-for="queue" data-dfn-type="dfn" data-export id="queue-enqueue">enqueue<a class="self-link" href="#queue-enqueue"></a></dfn> in a <a data-link-type="dfn" href="#queue" id="ref-for-queue">queue</a> is to <a data-link-type="dfn" href="#list-append" id="ref-for-list-append①⑦">append</a> to it. </p>
   <p>To <dfn class="dfn-paneled" data-dfn-for="queue" data-dfn-type="dfn" data-export id="queue-dequeue">dequeue</dfn> from a <a data-link-type="dfn" href="#queue" id="ref-for-queue①">queue</a> is to <a data-link-type="dfn" href="#list-remove" id="ref-for-list-remove⑥">remove</a> its first <a data-link-type="dfn" href="#list-item" id="ref-for-list-item①⑦">item</a> and return it, if the <a data-link-type="dfn" href="#queue" id="ref-for-queue②">queue</a> <a data-link-type="dfn" href="#list-is-empty" id="ref-for-list-is-empty②">is not empty</a>, or to return
nothing if it is. </p>
   <p>Although <a data-link-type="dfn" href="#queue" id="ref-for-queue③">queues</a> are <a data-link-type="dfn" href="#list" id="ref-for-list④①">lists</a>, <a data-link-type="dfn" href="#list-iterate" id="ref-for-list-iterate⑧">for each</a> must not be used with them;
instead, a combination of <a data-link-type="dfn" href="#iteration-while" id="ref-for-iteration-while③">while</a> and <a data-link-type="dfn" href="#queue-dequeue" id="ref-for-queue-dequeue">dequeue</a> is more appropriate. </p>
   <h4 class="heading settled" data-level="5.1.3" id="sets"><span class="secno">5.1.3. </span><span class="content">Sets</span><a class="self-link" href="#sets"></a></h4>
   <p>Some <a data-link-type="dfn" href="#list" id="ref-for-list④②">lists</a> are designated as <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="ordered set|set" id="ordered-set">ordered sets</dfn>. An
ordered set is a <a data-link-type="dfn" href="#list" id="ref-for-list④③">list</a> with the additional semantic that it must not contain the same <a data-link-type="dfn" href="#list-item" id="ref-for-list-item①⑧">item</a> twice. </p>
   <p class="note" role="note">Almost all cases on the web platform require an <em>ordered</em> set, instead of an
unordered one, since interoperability requires that any developer-exposed enumeration of the set’s
contents be consistent between browsers. In those cases where order is not important, we still use
ordered sets; implementations can optimize based on the fact that the order is not observable. </p>
   <p>To <dfn class="dfn-paneled" data-dfn-for="set" data-dfn-type="dfn" data-export id="set-append">append</dfn> to an <a data-link-type="dfn" href="#ordered-set" id="ref-for-ordered-set⑦">ordered set</a>: if the set <a data-link-type="dfn" href="#list-contain" id="ref-for-list-contain⑤">contains</a> the given <a data-link-type="dfn" href="#list-item" id="ref-for-list-item①⑨">item</a>, then do nothing; otherwise, perform the normal <a data-link-type="dfn" href="#list" id="ref-for-list④④">list</a> <a data-link-type="dfn" href="#list-append" id="ref-for-list-append①⑧">append</a> operation. </p>
   <p>To <dfn class="dfn-paneled" data-dfn-for="set" data-dfn-type="dfn" data-export id="set-prepend">prepend</dfn> to an <a data-link-type="dfn" href="#ordered-set" id="ref-for-ordered-set⑧">ordered set</a>: if the set <a data-link-type="dfn" href="#list-contain" id="ref-for-list-contain⑥">contains</a> the given <a data-link-type="dfn" href="#list-item" id="ref-for-list-item②⓪">item</a>, then do nothing; otherwise, perform the
normal <a data-link-type="dfn" href="#list" id="ref-for-list④⑤">list</a> <a data-link-type="dfn" href="#list-prepend" id="ref-for-list-prepend③">prepend</a> operation. </p>
   <p>To <dfn class="dfn-paneled" data-dfn-for="set" data-dfn-type="dfn" data-export data-lt="replace|replacing" id="set-replace">replace</dfn> within an <a data-link-type="dfn" href="#ordered-set" id="ref-for-ordered-set⑨">ordered set</a> <var>set</var>, given <var>item</var> and <var>replacement</var>: if <var>set</var> <a data-link-type="dfn" href="#list-contain" id="ref-for-list-contain⑦">contains</a> <var>item</var> or <var>replacement</var>, then replace the first instance
of either with <var>replacement</var> and <a data-link-type="dfn" href="#list-remove" id="ref-for-list-remove⑦">remove</a> all other instances. </p>
   <p class="example" id="example-set-replace"><a class="self-link" href="#example-set-replace"></a><a data-link-type="dfn" href="#set-replace" id="ref-for-set-replace②">Replacing</a> "a" with "c" within the <a data-link-type="dfn" href="#ordered-set" id="ref-for-ordered-set①⓪">ordered set</a> « "a", "b", "c" » gives « "c", "b" ». Within « "c", "b", "a" » it gives
« "c", "b" » as well. </p>
   <p>An <a data-link-type="dfn" href="#ordered-set" id="ref-for-ordered-set①①">ordered set</a> <var>set</var> is a <dfn class="dfn-paneled" data-dfn-for="set" data-dfn-type="dfn" data-export id="set-subset">subset</dfn> of another <a data-link-type="dfn" href="#ordered-set" id="ref-for-ordered-set①②">ordered set</a> <var>superset</var> (and conversely, <var>superset</var> is a <dfn class="dfn-paneled" data-dfn-for="set" data-dfn-type="dfn" data-export id="set-superset">superset</dfn> of <var>set</var>) if, <a data-link-type="dfn" href="#list-iterate" id="ref-for-list-iterate⑨">for each</a> <var>item</var> of <var>set</var>, <var>superset</var> <a data-link-type="dfn" href="#list-contain" id="ref-for-list-contain⑧">contains</a> <var>item</var>. </p>
   <p class="note" role="note">This implies that an <a data-link-type="dfn" href="#ordered-set" id="ref-for-ordered-set①③">ordered set</a> is both a <a data-link-type="dfn" href="#set-subset" id="ref-for-set-subset">subset</a> and a <a data-link-type="dfn" href="#set-superset" id="ref-for-set-superset">superset</a> of itself. </p>
   <p>The <dfn data-dfn-for="set" data-dfn-type="dfn" data-export id="set-intersection">intersection<a class="self-link" href="#set-intersection"></a></dfn> of <a data-link-type="dfn" href="#ordered-set" id="ref-for-ordered-set①④">ordered sets</a> <var>A</var> and <var>B</var>, is the result
of creating a new <a data-link-type="dfn" href="#ordered-set" id="ref-for-ordered-set①⑤">ordered set</a> <var>set</var> and, <a data-link-type="dfn" href="#list-iterate" id="ref-for-list-iterate①⓪">for each</a> <var>item</var> of <var>A</var>, if <var>B</var> <a data-link-type="dfn" href="#list-contain" id="ref-for-list-contain⑨">contains</a> <var>item</var>, <a data-link-type="dfn" href="#set-append" id="ref-for-set-append②">appending</a> <var>item</var> to <var>set</var>. </p>
   <p>The <dfn data-dfn-for="set" data-dfn-type="dfn" data-export id="set-union">union<a class="self-link" href="#set-union"></a></dfn> of <a data-link-type="dfn" href="#ordered-set" id="ref-for-ordered-set①⑥">ordered sets</a> <var>A</var> and <var>B</var>, is the result of <a data-link-type="dfn" href="#list-clone" id="ref-for-list-clone①">cloning</a> <var>A</var> as <var>set</var> and, <a data-link-type="dfn" href="#list-iterate" id="ref-for-list-iterate①①">for each</a> <var>item</var> of <var>B</var>, <a data-link-type="dfn" href="#set-append" id="ref-for-set-append③">appending</a> <var>item</var> to <var>set</var>. </p>
   <hr>
   <p><dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="the range" id="the-range">The range</dfn> <var>n</var> to <var>m</var>, inclusive, creates a new <a data-link-type="dfn" href="#ordered-set" id="ref-for-ordered-set①⑦">ordered set</a> containing all of the integers from <var>n</var> up to and including <var>m</var> in consecutively increasing order, as long as <var>m</var> is greater than or equal to <var>n</var>. </p>
   <p class="example" id="example-the-range"><a class="self-link" href="#example-the-range"></a><a data-link-type="dfn" href="#list-iterate" id="ref-for-list-iterate①②">For each</a> <var>n</var> of <a data-link-type="dfn" href="#the-range" id="ref-for-the-range">the range</a> 1 to
4, inclusive, … </p>
   <h3 class="heading settled" data-level="5.2" id="maps"><span class="secno">5.2. </span><span class="content">Maps</span><a class="self-link" href="#maps"></a></h3>
   <p>An <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="ordered map|map" id="ordered-map">ordered map</dfn>, or sometimes just "map", is a
specification type consisting of a finite ordered sequence of <dfn class="dfn-paneled" data-dfn-for="map" data-dfn-type="dfn" data-export id="map-key">key</dfn>/<dfn class="dfn-paneled" data-dfn-for="map" data-dfn-type="dfn" data-export id="map-value">value</dfn> pairs, with no key appearing twice.
Each key/value pair is called an <dfn class="dfn-paneled" data-dfn-for="map" data-dfn-type="dfn" data-export id="map-entry">entry</dfn>. </p>
   <p class="note" role="note">As with <a data-link-type="dfn" href="#ordered-set" id="ref-for-ordered-set①⑧">ordered sets</a>, by default we assume that maps need to be ordered for
interoperability among implementations. </p>
   <p>A literal syntax can be used to express <a data-link-type="dfn" href="#ordered-map" id="ref-for-ordered-map①">ordered maps</a>, by surrounding the ordered map with
«[ ]» characters, denoting each of its <a data-link-type="dfn" href="#map-entry" id="ref-for-map-entry">entries</a> as <var>key</var> → <var>value</var>, and separating its
entries with a comma. An indexing syntax can be used to look up and set <a data-link-type="dfn" href="#map-value" id="ref-for-map-value">values</a> by
providing a <a data-link-type="dfn" href="#map-key" id="ref-for-map-key">key</a> inside square brackets. The index cannot be out-of-bounds, except
when used with <a data-link-type="dfn" href="#map-exists" id="ref-for-map-exists">exists</a>. </p>
   <p class="example" id="example-map-notation"><a class="self-link" href="#example-map-notation"></a>Let <var>example</var> be the <a data-link-type="dfn" href="#ordered-map" id="ref-for-ordered-map②">ordered map</a> «[
"<code>a</code>" → `<code>x</code>`, "<code>b</code>" → `<code>y</code>` ]». Then <var>example</var>["<code>a</code>"] is the <a data-link-type="dfn" href="#byte-sequence" id="ref-for-byte-sequence①⑤">byte sequence</a> `<code>x</code>`. </p>
   <hr>
   <p>To <dfn data-dfn-for="map" data-dfn-type="dfn" data-export data-lt="get|get the value" id="map-get">get the value of an entry<a class="self-link" href="#map-get"></a></dfn> in an <a data-link-type="dfn" href="#ordered-map" id="ref-for-ordered-map③">ordered map</a> given a <a data-link-type="dfn" href="#map-key" id="ref-for-map-key①">key</a>, return the <a data-link-type="dfn" href="#map-value" id="ref-for-map-value①">value</a> of the <a data-link-type="dfn" href="#map-entry" id="ref-for-map-entry①">entry</a> whose <a data-link-type="dfn" href="#map-key" id="ref-for-map-key②">key</a> is the given key. We can also use the indexing syntax
explained above. </p>
   <p>To <dfn class="dfn-paneled" data-dfn-for="map" data-dfn-type="dfn" data-export data-lt="set|set the value" id="map-set">set the value of an entry</dfn> in an <a data-link-type="dfn" href="#ordered-map" id="ref-for-ordered-map④">ordered map</a> to a given <a data-link-type="dfn" href="#map-value" id="ref-for-map-value②">value</a> is to update the value of any existing <a data-link-type="dfn" href="#map-entry" id="ref-for-map-entry②">entry</a> if the map <a data-link-type="dfn" href="#map-exists" id="ref-for-map-exists①">contains</a> an entry with the given <a data-link-type="dfn" href="#map-key" id="ref-for-map-key③">key</a>,
or if none such exists, to add a new entry with the given key/value to the end of the map. We can
also denote this by saying, for an <a data-link-type="dfn" href="#ordered-map" id="ref-for-ordered-map⑤">ordered map</a> <var>map</var>, key <var>key</var>, and value <var>value</var>,
"<a data-link-type="dfn" href="#map-set" id="ref-for-map-set">set</a> <var>map</var>[<var>key</var>] to <var>value</var>". </p>
   <p>To <dfn class="dfn-paneled" data-dfn-for="map" data-dfn-type="dfn" data-export data-lt="remove" id="map-remove">remove an entry</dfn> from an <a data-link-type="dfn" href="#ordered-map" id="ref-for-ordered-map⑥">ordered map</a> is to remove
all <a data-link-type="dfn" href="#map-entry" id="ref-for-map-entry③">entries</a> from the map that match a given condition, or do nothing if none do. If
the condition is having a certain <a data-link-type="dfn" href="#map-key" id="ref-for-map-key④">key</a>, then we can also denote this by saying, for
an <a data-link-type="dfn" href="#ordered-map" id="ref-for-ordered-map⑦">ordered map</a> <var>map</var> and key <var>key</var>, "<a data-link-type="dfn" href="#map-remove" id="ref-for-map-remove">remove</a> <var>map</var>[<var>key</var>]". </p>
   <p>An <a data-link-type="dfn" href="#ordered-map" id="ref-for-ordered-map⑧">ordered map</a> <dfn class="dfn-paneled" data-dfn-for="map" data-dfn-type="dfn" data-export data-lt="exist|contain" id="map-exists">contains an <a data-link-type="dfn" href="#map-entry" id="ref-for-map-entry④">entry</a> with a given key</dfn> if there exists an entry with that <a data-link-type="dfn" href="#map-key" id="ref-for-map-key⑤">key</a>.
We can also denote this by saying that, for an <a data-link-type="dfn" href="#ordered-map" id="ref-for-ordered-map⑨">ordered map</a> <var>map</var> and key <var>key</var>, "<var>map</var>[<var>key</var>] <a data-link-type="dfn" href="#map-exists" id="ref-for-map-exists②">exists</a>". </p>
   <p>To <dfn class="dfn-paneled" data-dfn-for="map" data-dfn-type="dfn" data-export data-lt="getting the keys|get the keys" id="map-getting-the-keys">get the keys</dfn> of an <a data-link-type="dfn" href="#ordered-map" id="ref-for-ordered-map①⓪">ordered map</a>, return a new <a data-link-type="dfn" href="#ordered-set" id="ref-for-ordered-set①⑨">ordered set</a> whose <a data-link-type="dfn" href="#list-item" id="ref-for-list-item②①">items</a> are each of the <a data-link-type="dfn" href="#map-key" id="ref-for-map-key⑥">keys</a> in the map’s <a data-link-type="dfn" href="#map-entry" id="ref-for-map-entry⑤">entries</a>. </p>
   <p>To <dfn data-dfn-for="map" data-dfn-type="dfn" data-export data-lt="getting the values|get the values" id="map-getting-the-values">get the values<a class="self-link" href="#map-getting-the-values"></a></dfn> of an <a data-link-type="dfn" href="#ordered-map" id="ref-for-ordered-map①①">ordered map</a>, return a new <a data-link-type="dfn" href="#list" id="ref-for-list④⑥">list</a> whose <a data-link-type="dfn" href="#list-item" id="ref-for-list-item②②">items</a> are each of the <a data-link-type="dfn" href="#map-value" id="ref-for-map-value③">values</a> in the map’s <a data-link-type="dfn" href="#map-entry" id="ref-for-map-entry⑥">entries</a>. </p>
   <p>An <a data-link-type="dfn" href="#ordered-map" id="ref-for-ordered-map①②">ordered map</a>’s <dfn class="dfn-paneled" data-dfn-for="map" data-dfn-type="dfn" data-export id="map-size">size</dfn> is the <a data-link-type="dfn" href="#list-size" id="ref-for-list-size②">size</a> of the result
of running <a data-link-type="dfn" href="#map-getting-the-keys" id="ref-for-map-getting-the-keys">get the keys</a> on the map. </p>
   <p>An <a data-link-type="dfn" href="#ordered-map" id="ref-for-ordered-map①③">ordered map</a> <dfn data-dfn-for="map" data-dfn-type="dfn" data-export data-lt="is empty|is not empty" id="map-is-empty">is empty<a class="self-link" href="#map-is-empty"></a></dfn> if its <a data-link-type="dfn" href="#map-size" id="ref-for-map-size">size</a> is zero. </p>
   <p>To <dfn class="dfn-paneled" data-dfn-for="map" data-dfn-type="dfn" data-export data-lt="iterate|for each" id="map-iterate">iterate</dfn> over an <a data-link-type="dfn" href="#ordered-map" id="ref-for-ordered-map①④">ordered map</a>, performing
a set of steps on each <a data-link-type="dfn" href="#map-entry" id="ref-for-map-entry⑦">entry</a> in order, use phrasing of the form
"<a data-link-type="dfn" href="#map-iterate" id="ref-for-map-iterate①">For each</a> <var>key</var> → <var>value</var> of <var>map</var>", and then operate on <var>key</var> and <var>value</var> in the
subsequent prose. </p>
   <p>To <dfn data-dfn-for="map" data-dfn-type="dfn" data-export id="map-clone">clone<a class="self-link" href="#map-clone"></a></dfn> an <a data-link-type="dfn" href="#ordered-map" id="ref-for-ordered-map①⑤">ordered map</a> <var>map</var> is to create a new <a data-link-type="dfn" href="#ordered-map" id="ref-for-ordered-map①⑥">ordered map</a> <var>clone</var>, and, <a data-link-type="dfn" href="#map-iterate" id="ref-for-map-iterate②">for each</a> <var>key</var> → <var>value</var> of <var>map</var>, <a data-link-type="dfn" href="#map-set" id="ref-for-map-set①">set</a> <var>clone</var>[<var>key</var>] to <var>value</var>. </p>
   <p class="note" role="note">This is a "shallow clone", as the <a data-link-type="dfn" href="#map-key" id="ref-for-map-key⑦">keys</a> and <a data-link-type="dfn" href="#map-value" id="ref-for-map-value④">values</a> themselves are not cloned in any way. </p>
   <p class="example" id="example-map-clone"><a class="self-link" href="#example-map-clone"></a>Let <var>original</var> be the <a data-link-type="dfn" href="#ordered-map" id="ref-for-ordered-map①⑦">ordered map</a> «[
"<code>a</code>" → «1, 2, 3», "<code>b</code>" → «» ]». <a data-link-type="dfn" href="#list-clone" id="ref-for-list-clone②">Cloning</a> <var>original</var> creates a
new <a data-link-type="dfn" href="#ordered-map" id="ref-for-ordered-map①⑧">ordered map</a> <var>clone</var>, so that <a data-link-type="dfn" href="#map-set" id="ref-for-map-set②">setting</a> <var>clone</var>["<code>a</code>"] to
«-1, -2, -3» gives «[ "<code>a</code>" → «-1, -2, -3», "<code>b</code>" → «» ]» and leaves <var>original</var> unchanged. However, <a data-link-type="dfn" href="#list-append" id="ref-for-list-append①⑨">appending</a> 4 to <var>clone</var>["<code>b</code>"] will modify
the corresponding <a data-link-type="dfn" href="#map-value" id="ref-for-map-value⑤">value</a> in both <var>clone</var> and <var>original</var>, as they both point to the
same <a data-link-type="dfn" href="#list" id="ref-for-list④⑦">list</a>. </p>
   <p>To <dfn data-dfn-for="map" data-dfn-type="dfn" data-export data-lt="sort in ascending order|sorting in ascending order|sort|sorting" id="map-sort-in-ascending-order">sort in ascending order<a class="self-link" href="#map-sort-in-ascending-order"></a></dfn> a <a data-link-type="dfn" href="#ordered-map" id="ref-for-ordered-map①⑨">map</a> <var>map</var>, with a less than algorithm <var>lessThanAlgo</var>, is to create a new <a data-link-type="dfn" href="#ordered-map" id="ref-for-ordered-map②⓪">map</a> <var>sorted</var>, containing the same <a data-link-type="dfn" href="#map-entry" id="ref-for-map-entry⑧">entries</a> as <var>map</var> but sorted so that according to <var>lessThanAlgo</var>, each entry is less than the one following it, if any. For entries that sort the same
(i.e., for which <var>lessThanAlgo</var> returns false for both comparisons), their relative order in <var>sorted</var> must be the same as it was in <var>map</var>. </p>
   <p>To <dfn data-dfn-for="map" data-dfn-type="dfn" data-export data-lt="sort in descending order|sorting in descending order" id="map-sort-in-descending-order">sort in descending order<a class="self-link" href="#map-sort-in-descending-order"></a></dfn> a <a data-link-type="dfn" href="#ordered-map" id="ref-for-ordered-map②①">map</a> <var>map</var>, with a less than algorithm <var>lessThanAlgo</var>, is to create a new <a data-link-type="dfn" href="#ordered-map" id="ref-for-ordered-map②②">map</a> <var>sorted</var>, containing the same <a data-link-type="dfn" href="#map-entry" id="ref-for-map-entry⑨">entries</a> as <var>map</var> but sorted so that according to <var>lessThanAlgo</var>, each entry is less than the one preceding it, if any. For entries that sort the same
(i.e., for which <var>lessThanAlgo</var> returns false for both comparisons), their relative order in <var>sorted</var> must be the same as it was in <var>map</var>. </p>
   <h3 class="heading settled" data-level="5.3" id="structs"><span class="secno">5.3. </span><span class="content">Structs</span><a class="self-link" href="#structs"></a></h3>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="struct">struct</dfn> is a specification type consisting of a finite set of <dfn class="dfn-paneled" data-dfn-for="struct,tuple,pair" data-dfn-type="dfn" data-export data-lt="item" id="struct-item">items</dfn>, each of which has a unique and immutable <dfn class="dfn-paneled" data-dfn-for="struct,tuple,pair" data-dfn-type="dfn" data-export id="struct-name">name</dfn>. </p>
   <hr>
   <p><a data-link-type="dfn" href="#struct" id="ref-for-struct">Structs</a> with a defined order are also known as <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="tuple" id="tuple">tuples</dfn>. For
notational convenience, a literal syntax can be used to express <a data-link-type="dfn" href="#tuple" id="ref-for-tuple">tuples</a>, by surrounding the
tuple with parenthesis and separating its <a data-link-type="dfn" href="#struct-item" id="ref-for-struct-item②">items</a> with a comma. To use this notation,
the <a data-link-type="dfn" href="#struct-name" id="ref-for-struct-name">names</a> need to be clear from context. This can be done by preceding the first
instance with the name given to the <a data-link-type="dfn" href="#tuple" id="ref-for-tuple①">tuple</a>. </p>
   <div class="example" id="example-tuple">
    <a class="self-link" href="#example-tuple"></a> 
    <p>A status is an example <a data-link-type="dfn" href="#tuple" id="ref-for-tuple②">tuple</a> consisting of a code (a three-digit number) and text (a byte
 sequence). </p>
    <p>A nonsense algorithm that manipulates status tuples for the purpose of demonstrating their
 usage is then:</p>
    <ol>
     <li>Let <var>statusInstance</var> be the status (200, `<code>OK</code>`). 
     <li>Set <var>statusInstance</var> to (301, `<code>FOO BAR</code>`). 
     <li>If <var>statusInstance</var>’s code is 404, then … 
    </ol>
   </div>
   <p class="note" role="note">It is intentional that not all <a data-link-type="dfn" href="#struct" id="ref-for-struct①">structs</a> are <a data-link-type="dfn" href="#tuple" id="ref-for-tuple③">tuples</a>. Documents using the
Infra Standard might need the flexibility to add new <a data-link-type="dfn" href="#struct-name" id="ref-for-struct-name①">names</a> to their struct
without breaking literal syntax used by their dependencies. In that case a tuple is not appropriate. </p>
   <hr>
   <p><a data-link-type="dfn" href="#tuple" id="ref-for-tuple④">Tuples</a> with two <a data-link-type="dfn" href="#struct-item" id="ref-for-struct-item③">items</a> are also known as <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="pair" id="pair">pairs</dfn>.
For <a data-link-type="dfn" href="#pair" id="ref-for-pair">pairs</a>, a slightly shorter literal syntax can be used, separating the two <a data-link-type="dfn" href="#struct-item" id="ref-for-struct-item④">items</a> with a / character. </p>
   <p class="example" id="example-pair"><a class="self-link" href="#example-pair"></a>Another way of expressing our <var>statusInstance</var> tuple above would be
as 200/`<code>OK</code>`. </p>
   <h2 class="heading settled" data-level="6" id="json"><span class="secno">6. </span><span class="content">JSON</span><a class="self-link" href="#json"></a></h2>
   <p class="note" role="note">The conventions used in the algorithms in this section are those of the JavaScript
specification. <a data-link-type="biblio" href="#biblio-ecma-262">[ECMA-262]</a> </p>
   <p>To <dfn data-dfn-type="dfn" data-export id="parse-json-from-bytes">parse JSON from bytes<a class="self-link" href="#parse-json-from-bytes"></a></dfn> given <var>bytes</var>, run these steps: </p>
   <ol>
    <li>
     <p>Let <var>jsonText</var> be the result of running <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8-decode" id="ref-for-utf-8-decode③">UTF-8 decode</a> on <var>bytes</var>. <a data-link-type="biblio" href="#biblio-encoding">[ENCODING]</a> </p>
    <li>
     <p>Return ? <a data-link-type="abstract-op" href="https://tc39.github.io/ecma262/#sec-call" id="ref-for-sec-call">Call</a>(<a data-link-type="dfn" href="https://tc39.github.io/ecma262/#sec-json.parse" id="ref-for-sec-json.parse">%JSONParse%</a>, undefined, « <var>jsonText</var> »). </p>
   </ol>
   <p>To <dfn data-dfn-type="dfn" data-export id="serialize-json-to-bytes">serialize JSON to bytes<a class="self-link" href="#serialize-json-to-bytes"></a></dfn> a given JavaScript value <var>value</var>, run these
steps: </p>
   <ol>
    <li>
     <p>Let <var>jsonString</var> be
  ? <a data-link-type="abstract-op" href="https://tc39.github.io/ecma262/#sec-call" id="ref-for-sec-call①">Call</a>(<a data-link-type="dfn" href="https://tc39.github.io/ecma262/#sec-json.stringify" id="ref-for-sec-json.stringify">%JSONStringify%</a>, undefined, « <var>value</var> »). </p>
     <p class="note" role="note">Since no additional arguments are passed to <a data-link-type="dfn" href="https://tc39.github.io/ecma262/#sec-json.stringify" id="ref-for-sec-json.stringify①">%JSONStringify%</a>, the resulting
  string will have no whitespace inserted. </p>
    <li>
     <p>Return the result of running <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8-encode" id="ref-for-utf-8-encode③">UTF-8 encode</a> on <var>jsonString</var>. <a data-link-type="biblio" href="#biblio-encoding">[ENCODING]</a> </p>
   </ol>
   <hr>
   <p>The above two operations operate on JavaScript values directly; in particular, this means that
the involved objects or arrays are tied to a particular <a data-link-type="dfn" href="https://tc39.github.io/ecma262/#realm" id="ref-for-realm">JavaScript realm</a>. In
standards, it is often more convenient to parse JSON into realm-independent <a data-link-type="dfn" href="#ordered-map" id="ref-for-ordered-map②③">maps</a>, <a data-link-type="dfn" href="#list" id="ref-for-list④⑧">lists</a>, <a data-link-type="dfn" href="#string" id="ref-for-string④②">strings</a>, <a data-link-type="dfn" href="#boolean" id="ref-for-boolean">booleans</a>, numbers, and nulls. </p>
   <p>To <dfn data-dfn-type="dfn" data-export id="parse-json-into-infra-values">parse JSON into Infra values<a class="self-link" href="#parse-json-into-infra-values"></a></dfn>, given a <a data-link-type="dfn" href="#string" id="ref-for-string④③">string</a> <var>jsonText</var>: </p>
   <ol>
    <li>
     <p>Let <var>jsValue</var> be ? <a data-link-type="abstract-op" href="https://tc39.github.io/ecma262/#sec-call" id="ref-for-sec-call②">Call</a>(<a data-link-type="dfn" href="https://tc39.github.io/ecma262/#sec-json.parse" id="ref-for-sec-json.parse①">%JSONParse%</a>, undefined, « <var>jsonText</var> »). </p>
    <li>
     <p>Return the result of <a data-link-type="dfn" href="#convert-a-json-derived-javascript-value-to-an-infra-value" id="ref-for-convert-a-json-derived-javascript-value-to-an-infra-value">converting a JSON-derived JavaScript value to an Infra value</a>, given <var>jsValue</var>. </p>
   </ol>
   <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="convert a JSON-derived JavaScript value to an Infra value|converting a JSON-derived JavaScript value to an Infra value" data-noexport id="convert-a-json-derived-javascript-value-to-an-infra-value">convert a JSON-derived JavaScript value to an Infra value</dfn>,
given a JavaScript value <var>jsValue</var>: </p>
   <ol>
    <li>
     <p>If <a data-link-type="abstract-op" href="https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values" id="ref-for-sec-ecmascript-data-types-and-values">Type</a>(<var>jsValue</var>) is Null, Boolean, String, or Number, then return <var>jsValue</var>. </p>
    <li>
     <p>If <a data-link-type="abstract-op" href="https://tc39.github.io/ecma262/#sec-isarray" id="ref-for-sec-isarray">IsArray</a>(<var>jsValue</var>) is true, then: </p>
     <ol>
      <li>
       <p>Let <var>result</var> be an empty <a data-link-type="dfn" href="#list" id="ref-for-list④⑨">list</a>. </p>
      <li>
       <p>Let <var>length</var> be ! <a data-link-type="abstract-op" href="https://tc39.github.io/ecma262/#sec-tolength" id="ref-for-sec-tolength">ToLength</a>(! <a data-link-type="abstract-op" href="https://tc39.github.io/ecma262/#sec-get-o-p" id="ref-for-sec-get-o-p">Get</a>(<var>jsValue</var>, "<code>length</code>")). </p>
      <li>
       <p><a data-link-type="dfn" href="#list-iterate" id="ref-for-list-iterate①③">For each</a> <var>index</var> of <a data-link-type="dfn" href="#the-range" id="ref-for-the-range①">the range</a> 0 to <var>length</var> − 1, inclusive: </p>
       <ol>
        <li>
         <p>Let <var>indexName</var> be ! <a data-link-type="abstract-op" href="https://tc39.github.io/ecma262/#sec-tostring" id="ref-for-sec-tostring">ToString</a>(<var>index</var>). </p>
        <li>
         <p>Let <var>jsValueAtIndex</var> be ! <a data-link-type="abstract-op" href="https://tc39.github.io/ecma262/#sec-get-o-p" id="ref-for-sec-get-o-p①">Get</a>(<var>jsValue</var>, <var>indexName</var>). </p>
        <li>
         <p>Let <var>infraValueAtIndex</var> be the result of <a data-link-type="dfn" href="#convert-a-json-derived-javascript-value-to-an-infra-value" id="ref-for-convert-a-json-derived-javascript-value-to-an-infra-value①">converting a JSON-derived JavaScript value to an Infra value</a>,
       given <var>jsValueAtIndex</var>. </p>
        <li>
         <p><a data-link-type="dfn" href="#list-append" id="ref-for-list-append②⓪">Append</a> <var>infraValueAtIndex</var> to <var>result</var>. </p>
       </ol>
      <li>
       <p>Return <var>result</var>. </p>
     </ol>
    <li>
     <p>Let <var>result</var> be an empty <a data-link-type="dfn" href="#ordered-map" id="ref-for-ordered-map②④">ordered map</a>. </p>
    <li>
     <p><a data-link-type="dfn" href="#list-iterate" id="ref-for-list-iterate①④">For each</a> <var>key</var> of ! <var>jsValue</var>.[[OwnPropertyKeys]](): </p>
     <ol>
      <li>
       <p>Let <var>jsValueAtKey</var> be ! <a data-link-type="abstract-op" href="https://tc39.github.io/ecma262/#sec-get-o-p" id="ref-for-sec-get-o-p②">Get</a>(<var>jsValue</var>, <var>key</var>). </p>
      <li>
       <p>Let <var>infraValueAtKey</var> be the result of <a data-link-type="dfn" href="#convert-a-json-derived-javascript-value-to-an-infra-value" id="ref-for-convert-a-json-derived-javascript-value-to-an-infra-value②">converting a JSON-derived JavaScript value to an Infra value</a>,
    given <var>jsValueAtKey</var>. </p>
      <li>
       <p><a data-link-type="dfn" href="#map-set" id="ref-for-map-set③">Set</a> <var>result</var>[<var>key</var>] to <var>infraValueAtKey</var>. </p>
     </ol>
    <li>
     <p>Return <var>result</var>. </p>
   </ol>
   <h2 class="heading settled" data-level="7" id="forgiving-base64"><span class="secno">7. </span><span class="content">Forgiving base64</span><a class="self-link" href="#forgiving-base64"></a></h2>
   <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="forgiving-base64-encode">forgiving-base64 encode</dfn> given a <a data-link-type="dfn" href="#byte-sequence" id="ref-for-byte-sequence①⑥">byte sequence</a> <var>data</var>, apply
the base64 algorithm defined in section 4 of RFC 4648 to <var>data</var> and return the result. <a data-link-type="biblio" href="#biblio-rfc4648">[RFC4648]</a> </p>
   <p class="note no-backref" role="note">This is named <a data-link-type="dfn" href="#forgiving-base64-encode" id="ref-for-forgiving-base64-encode">forgiving-base64 encode</a> for symmetry with <a data-link-type="dfn" href="#forgiving-base64-decode" id="ref-for-forgiving-base64-decode">forgiving-base64 decode</a>, which is different from the RFC as it defines error handling for
certain inputs. </p>
   <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="forgiving-base64-decode">forgiving-base64 decode</dfn> given a string <var>data</var>, run these steps:</p>
   <ol>
    <li>
     <p>Remove all <a data-link-type="dfn" href="#ascii-whitespace" id="ref-for-ascii-whitespace⑥">ASCII whitespace</a> from <var>data</var>. </p>
    <li>
     <p>If <var>data</var>’s <a data-link-type="dfn" href="#string-length" id="ref-for-string-length④">length</a> divides by 4 leaving no remainder, then: </p>
     <ol>
      <li>
       <p>If <var>data</var> ends with one or two U+003D (=) <a data-link-type="dfn" href="#code-point" id="ref-for-code-point④⑧">code points</a>, then remove them
   from <var>data</var>. </p>
     </ol>
    <li>
     <p>If <var>data</var>’s <a data-link-type="dfn" href="#string-length" id="ref-for-string-length⑤">length</a> divides by 4 leaving a remainder of 1, then
 return failure. </p>
    <li>
     <p>If <var>data</var> contains a <a data-link-type="dfn" href="#code-point" id="ref-for-code-point④⑨">code point</a> that is not one of </p>
     <ul class="brief">
      <li>U+002B (+) 
      <li>U+002F (/) 
      <li><a data-link-type="dfn" href="#ascii-alphanumeric" id="ref-for-ascii-alphanumeric">ASCII alphanumeric</a> 
     </ul>
     <p>then return failure. </p>
    <li>
     <p>Let <var>output</var> be an empty <a data-link-type="dfn" href="#byte-sequence" id="ref-for-byte-sequence①⑦">byte sequence</a>. </p>
    <li>
     <p>Let <var>buffer</var> be an empty buffer that can have bits appended to it. </p>
    <li>
     <p>Let <var>position</var> be a <a data-link-type="dfn" href="#string-position-variable" id="ref-for-string-position-variable⑤">position variable</a> for <var>data</var>, initially
 pointing at the start of <var>data</var>. </p>
    <li>
     <p>While <var>position</var> does not point past the end of <var>data</var>: </p>
     <ol>
      <li>
       <p>Find the <a data-link-type="dfn" href="#code-point" id="ref-for-code-point⑤⓪">code point</a> pointed to by <var>position</var> in the second column of
   Table 1: The Base 64 Alphabet of RFC 4648. Let <var>n</var> be the number given in the first cell
   of the same row. <a data-link-type="biblio" href="#biblio-rfc4648">[RFC4648]</a> </p>
      <li>
       <p>Append the six bits corresponding to <var>n</var>, most significant bit first, to <var>buffer</var>. </p>
      <li>
       <p>If <var>buffer</var> has accumulated 24 bits, interpret them as three 8-bit big-endian
   numbers. Append three bytes with values equal to those numbers to <var>output</var>, in the same
   order, and then empty <var>buffer</var>. </p>
      <li>
       <p>Advance <var>position</var> by 1. </p>
     </ol>
    <li>
     <p>If <var>buffer</var> is not empty, it contains either 12 or 18 bits. If it contains 12 bits,
  then discard the last four and interpret the remaining eight as an 8-bit big-endian number. If it
  contains 18 bits, then discard the last two and interpret the remaining 16 as two 8-bit big-endian
  numbers. Append the one or two bytes with values equal to those one or two numbers to <var>output</var>, in the same order.</p>
     <p class="note" role="note">The discarded bits mean that, for instance, "<code>YQ</code>" and
  "<code>YR</code>" both return `<code>a</code>`. </p>
    <li>
     <p>Return <var>output</var>. </p>
   </ol>
   <h2 class="heading settled" data-level="8" id="namespaces"><span class="secno">8. </span><span class="content">Namespaces</span><a class="self-link" href="#namespaces"></a></h2>
   <p>The <dfn data-dfn-type="dfn" data-export id="html-namespace">HTML namespace<a class="self-link" href="#html-namespace"></a></dfn> is "<code>http://www.w3.org/1999/xhtml</code>". </p>
   <p>The <dfn data-dfn-type="dfn" data-export id="mathml-namespace">MathML namespace<a class="self-link" href="#mathml-namespace"></a></dfn> is "<code>http://www.w3.org/1998/Math/MathML</code>". </p>
   <p>The <dfn data-dfn-type="dfn" data-export id="svg-namespace">SVG namespace<a class="self-link" href="#svg-namespace"></a></dfn> is "<code>http://www.w3.org/2000/svg</code>". </p>
   <p>The <dfn data-dfn-type="dfn" data-export id="xlink-namespace">XLink namespace<a class="self-link" href="#xlink-namespace"></a></dfn> is "<code>http://www.w3.org/1999/xlink</code>". </p>
   <p>The <dfn data-dfn-type="dfn" data-export id="xml-namespace">XML namespace<a class="self-link" href="#xml-namespace"></a></dfn> is "<code>http://www.w3.org/XML/1998/namespace</code>". </p>
   <p>The <dfn data-dfn-type="dfn" data-export id="xmlns-namespace">XMLNS namespace<a class="self-link" href="#xmlns-namespace"></a></dfn> is "<code>http://www.w3.org/2000/xmlns/</code>". </p>
   <h2 class="no-num heading settled" id="acknowledgments"><span class="content">Acknowledgments</span><a class="self-link" href="#acknowledgments"></a></h2>
   <p>Many thanks to
Addison Phillips,
Aryeh Gregor,
Chris Rebert,
Daniel Ehrenberg,
Dominic Farolino,
Jake Archibald,
Jeff Hodges,
Jungkee Song,
Leonid Vasilyev,
Maciej Stachowiak,
Malika Aubakirova,
Michael™ Smith,
Mike West,
Ms2ger,
Pavel "Al Arz" Kurochkin,
Philip Jägenstedt,
Rashaun "Snuggs" Stovall,
Sergey Shekyan,
Simon Pieters,
Tab Atkins,
Tobie Langel,
triple-underscore,
and Xue Fuqiao
for being awesome! </p>
   <p>This standard is written by <a href="https://annevankesteren.nl/" lang="nl">Anne van Kesteren</a> (<a href="https://www.mozilla.org/">Mozilla</a>, <a href="mailto:annevk@annevk.nl">annevk@annevk.nl</a>) and <a href="https://domenic.me/">Domenic Denicola</a> (<a href="https://www.google.com/">Google</a>, <a href="mailto:d@domenic.me">d@domenic.me</a>). </p>
   <p>Copyright © 1970 WHATWG (Apple, Google, Mozilla, Microsoft). This work is licensed under a <a href="https://creativecommons.org/licenses/by/4.0/" rel="license">Creative Commons Attribution
4.0 International License</a>. </p>
  </main>
<script>
"use strict";
if ("serviceWorker" in navigator) {
  navigator.serviceWorker.register("/service-worker.js");
}
</script>
  <h2 class="no-num no-ref heading settled" id="index"><span class="content">Index</span><a class="self-link" href="#index"></a></h2>
  <h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="content">Terms defined by this specification</span><a class="self-link" href="#index-defined-here"></a></h3>
  <ul class="index">
   <li><a href="#abort-when">abort when</a><span>, in §3.3</span>
   <li>
    append
    <ul>
     <li><a href="#list-append">dfn for list</a><span>, in §5.1</span>
     <li><a href="#set-append">dfn for set</a><span>, in §5.1.3</span>
    </ul>
   <li><a href="#ascii-alpha">ASCII alpha</a><span>, in §4.5</span>
   <li><a href="#ascii-alphanumeric">ASCII alphanumeric</a><span>, in §4.5</span>
   <li><a href="#ascii-byte">ASCII byte</a><span>, in §4.3</span>
   <li><a href="#ascii-case-insensitive">ASCII case-insensitive</a><span>, in §4.6</span>
   <li><a href="#ascii-code-point">ASCII code point</a><span>, in §4.5</span>
   <li><a href="#ascii-decode">ASCII decode</a><span>, in §4.6</span>
   <li><a href="#ascii-digit">ASCII digit</a><span>, in §4.5</span>
   <li><a href="#ascii-encode">ASCII encode</a><span>, in §4.6</span>
   <li><a href="#ascii-hex-digit">ASCII hex digit</a><span>, in §4.5</span>
   <li><a href="#ascii-lower-alpha">ASCII lower alpha</a><span>, in §4.5</span>
   <li><a href="#ascii-lowercase">ASCII lowercase</a><span>, in §4.6</span>
   <li><a href="#ascii-lower-hex-digit">ASCII lower hex digit</a><span>, in §4.5</span>
   <li><a href="#ascii-string">ASCII string</a><span>, in §4.6</span>
   <li><a href="#ascii-tab-or-newline">ASCII tab or newline</a><span>, in §4.5</span>
   <li><a href="#ascii-tab-or-newline">ASCII tabs or newlines</a><span>, in §4.5</span>
   <li><a href="#ascii-upper-alpha">ASCII upper alpha</a><span>, in §4.5</span>
   <li><a href="#ascii-uppercase">ASCII uppercase</a><span>, in §4.6</span>
   <li><a href="#ascii-upper-hex-digit">ASCII upper hex digit</a><span>, in §4.5</span>
   <li><a href="#ascii-whitespace">ASCII whitespace</a><span>, in §4.5</span>
   <li><a href="#assert">Assert</a><span>, in §3.5</span>
   <li><a href="#boolean">boolean</a><span>, in §4.2</span>
   <li><a href="#iteration-break">break</a><span>, in §3.4</span>
   <li><a href="#byte">byte</a><span>, in §4.3</span>
   <li><a href="#byte-case-insensitive">byte-case-insensitive</a><span>, in §4.4</span>
   <li><a href="#byte-less-than">byte less than</a><span>, in §4.4</span>
   <li><a href="#byte-lowercase">byte-lowercase</a><span>, in §4.4</span>
   <li><a href="#byte-sequence">byte sequence</a><span>, in §4.4</span>
   <li><a href="#byte-uppercase">byte-uppercase</a><span>, in §4.4</span>
   <li><a href="#c0-control">C0 control</a><span>, in §4.5</span>
   <li><a href="#c0-control-or-space">C0 control or space</a><span>, in §4.5</span>
   <li><a href="#c0-control-or-space">C0 controls or spaces</a><span>, in §4.5</span>
   <li><a href="#code-point">character</a><span>, in §4.5</span>
   <li>
    clone
    <ul>
     <li><a href="#list-clone">dfn for list, stack, queue, set</a><span>, in §5.1</span>
     <li><a href="#map-clone">dfn for map</a><span>, in §5.2</span>
    </ul>
   <li><a href="#code-point">code point</a><span>, in §4.5</span>
   <li><a href="#code-unit">code unit</a><span>, in §4.6</span>
   <li><a href="#code-unit-less-than">code unit less than</a><span>, in §4.6</span>
   <li><a href="#code-unit-prefix">code unit prefix</a><span>, in §4.6</span>
   <li><a href="#collect-a-sequence-of-code-points">collect a sequence of code points</a><span>, in §4.6</span>
   <li><a href="#collect-a-sequence-of-code-points">collecting a sequence of code points</a><span>, in §4.6</span>
   <li><a href="#string-concatenate">concatenate</a><span>, in §4.6</span>
   <li><a href="#string-concatenate">concatenation</a><span>, in §4.6</span>
   <li>
    contain
    <ul>
     <li><a href="#list-contain">dfn for list, stack, queue, set</a><span>, in §5.1</span>
     <li><a href="#map-exists">dfn for map</a><span>, in §5.2</span>
    </ul>
   <li><a href="#iteration-continue">continue</a><span>, in §3.4</span>
   <li><a href="#control">control</a><span>, in §4.5</span>
   <li><a href="#javascript-string-convert">convert</a><span>, in §4.6</span>
   <li><a href="#convert-a-json-derived-javascript-value-to-an-infra-value">convert a JSON-derived JavaScript value to an Infra value</a><span>, in §6</span>
   <li><a href="#convert-a-json-derived-javascript-value-to-an-infra-value">converting a JSON-derived JavaScript value to an Infra value</a><span>, in §6</span>
   <li><a href="#queue-dequeue">dequeue</a><span>, in §5.1.2</span>
   <li><a href="#list-empty">empty</a><span>, in §5.1</span>
   <li><a href="#queue-enqueue">enqueue</a><span>, in §5.1.2</span>
   <li><a href="#map-entry">entry</a><span>, in §5.2</span>
   <li>
    exist
    <ul>
     <li><a href="#list-contain">dfn for list, stack, queue, set</a><span>, in §5.1</span>
     <li><a href="#map-exists">dfn for map</a><span>, in §5.2</span>
    </ul>
   <li><a href="#list-extend">extend</a><span>, in §5.1</span>
   <li>
    for each
    <ul>
     <li><a href="#list-iterate">dfn for list, set</a><span>, in §5.1</span>
     <li><a href="#map-iterate">dfn for map</a><span>, in §5.2</span>
    </ul>
   <li><a href="#forgiving-base64-decode">forgiving-base64 decode</a><span>, in §7</span>
   <li><a href="#forgiving-base64-encode">forgiving-base64 encode</a><span>, in §7</span>
   <li><a href="#map-get">get</a><span>, in §5.2</span>
   <li><a href="#map-getting-the-keys">get the keys</a><span>, in §5.2</span>
   <li><a href="#map-get">get the value</a><span>, in §5.2</span>
   <li><a href="#map-getting-the-values">get the values</a><span>, in §5.2</span>
   <li><a href="#map-getting-the-keys">getting the keys</a><span>, in §5.2</span>
   <li><a href="#map-getting-the-values">getting the values</a><span>, in §5.2</span>
   <li><a href="#html-namespace">HTML namespace</a><span>, in §8</span>
   <li><a href="#if-aborted">if aborted</a><span>, in §3.3</span>
   <li><a href="#list-insert">insert</a><span>, in §5.1</span>
   <li><a href="#set-intersection">intersection</a><span>, in §5.1.3</span>
   <li>
    is empty
    <ul>
     <li><a href="#list-is-empty">dfn for list, stack, queue, set</a><span>, in §5.1</span>
     <li><a href="#map-is-empty">dfn for map</a><span>, in §5.2</span>
    </ul>
   <li>
    is not empty
    <ul>
     <li><a href="#list-is-empty">dfn for list, stack, queue, set</a><span>, in §5.1</span>
     <li><a href="#map-is-empty">dfn for map</a><span>, in §5.2</span>
    </ul>
   <li><a href="#isomorphic-decode">isomorphic decode</a><span>, in §4.4</span>
   <li><a href="#isomorphic-encode">isomorphic encode</a><span>, in §4.6</span>
   <li>
    item
    <ul>
     <li><a href="#list-item">dfn for list, stack, queue, set</a><span>, in §5.1</span>
     <li><a href="#struct-item">dfn for struct, tuple, pair</a><span>, in §5.3</span>
    </ul>
   <li>
    iterate
    <ul>
     <li><a href="#list-iterate">dfn for list, set</a><span>, in §5.1</span>
     <li><a href="#map-iterate">dfn for map</a><span>, in §5.2</span>
    </ul>
   <li><a href="#javascript-string">JavaScript string</a><span>, in §4.6</span>
   <li><a href="#map-key">key</a><span>, in §5.2</span>
   <li>
    length
    <ul>
     <li><a href="#javascript-string-length">dfn for JavaScript string</a><span>, in §4.6</span>
     <li><a href="#byte-sequence-length">dfn for byte sequence</a><span>, in §4.4</span>
     <li><a href="#string-length">dfn for string</a><span>, in §4.6</span>
    </ul>
   <li><a href="#list">list</a><span>, in §5.1</span>
   <li><a href="#ordered-map">map</a><span>, in §5.2</span>
   <li><a href="#mathml-namespace">MathML namespace</a><span>, in §8</span>
   <li><a href="#struct-name">name</a><span>, in §5.3</span>
   <li><a href="#noncharacter">noncharacter</a><span>, in §4.5</span>
   <li><a href="#normalize-newlines">normalize newlines</a><span>, in §4.6</span>
   <li><a href="#ordered-map">ordered map</a><span>, in §5.2</span>
   <li><a href="#ordered-set">ordered set</a><span>, in §5.1.3</span>
   <li><a href="#pair">pair</a><span>, in §5.3</span>
   <li><a href="#parse-json-from-bytes">parse JSON from bytes</a><span>, in §6</span>
   <li><a href="#parse-json-into-infra-values">parse JSON into Infra values</a><span>, in §6</span>
   <li><a href="#stack-pop">pop</a><span>, in §5.1.1</span>
   <li><a href="#string-position-variable">position variable</a><span>, in §4.6</span>
   <li>
    prepend
    <ul>
     <li><a href="#list-prepend">dfn for list</a><span>, in §5.1</span>
     <li><a href="#set-prepend">dfn for set</a><span>, in §5.1.3</span>
    </ul>
   <li><a href="#stack-push">push</a><span>, in §5.1.1</span>
   <li><a href="#queue">queue</a><span>, in §5.1.2</span>
   <li>
    remove
    <ul>
     <li><a href="#list-remove">dfn for list, set</a><span>, in §5.1</span>
     <li><a href="#map-remove">dfn for map</a><span>, in §5.2</span>
    </ul>
   <li>
    replace
    <ul>
     <li><a href="#list-replace">dfn for list</a><span>, in §5.1</span>
     <li><a href="#set-replace">dfn for set</a><span>, in §5.1.3</span>
    </ul>
   <li><a href="#set-replace">replacing</a><span>, in §5.1.3</span>
   <li><a href="#scalar-value">scalar value</a><span>, in §4.5</span>
   <li><a href="#scalar-value-string">scalar value string</a><span>, in §4.6</span>
   <li><a href="#serialize-json-to-bytes">serialize JSON to bytes</a><span>, in §6</span>
   <li>
    set
    <ul>
     <li><a href="#ordered-set">definition of</a><span>, in §5.1.3</span>
     <li><a href="#map-set">dfn for map</a><span>, in §5.2</span>
    </ul>
   <li><a href="#map-set">set the value</a><span>, in §5.2</span>
   <li>
    size
    <ul>
     <li><a href="#list-size">dfn for list, stack, queue, set</a><span>, in §5.1</span>
     <li><a href="#map-size">dfn for map</a><span>, in §5.2</span>
    </ul>
   <li><a href="#skip-ascii-whitespace">skip ASCII whitespace</a><span>, in §4.6</span>
   <li>
    sort
    <ul>
     <li><a href="#list-sort-in-ascending-order">dfn for list, stack, queue, set</a><span>, in §5.1</span>
     <li><a href="#map-sort-in-ascending-order">dfn for map</a><span>, in §5.2</span>
    </ul>
   <li>
    sort in ascending order
    <ul>
     <li><a href="#list-sort-in-ascending-order">dfn for list, stack, queue, set</a><span>, in §5.1</span>
     <li><a href="#map-sort-in-ascending-order">dfn for map</a><span>, in §5.2</span>
    </ul>
   <li>
    sort in descending order
    <ul>
     <li><a href="#list-sort-in-descending-order">dfn for list, stack, queue, set</a><span>, in §5.1</span>
     <li><a href="#map-sort-in-descending-order">dfn for map</a><span>, in §5.2</span>
    </ul>
   <li>
    sorting
    <ul>
     <li><a href="#list-sort-in-ascending-order">dfn for list, stack, queue, set</a><span>, in §5.1</span>
     <li><a href="#map-sort-in-ascending-order">dfn for map</a><span>, in §5.2</span>
    </ul>
   <li>
    sorting in ascending order
    <ul>
     <li><a href="#list-sort-in-ascending-order">dfn for list, stack, queue, set</a><span>, in §5.1</span>
     <li><a href="#map-sort-in-ascending-order">dfn for map</a><span>, in §5.2</span>
    </ul>
   <li>
    sorting in descending order
    <ul>
     <li><a href="#list-sort-in-descending-order">dfn for list, stack, queue, set</a><span>, in §5.1</span>
     <li><a href="#map-sort-in-descending-order">dfn for map</a><span>, in §5.2</span>
    </ul>
   <li><a href="#split-on-ascii-whitespace">split a string on ASCII whitespace</a><span>, in §4.6</span>
   <li><a href="#split-on-commas">split a string on commas</a><span>, in §4.6</span>
   <li><a href="#split-on-ascii-whitespace">split on ASCII whitespace</a><span>, in §4.6</span>
   <li><a href="#split-on-commas">split on commas</a><span>, in §4.6</span>
   <li><a href="#stack">stack</a><span>, in §5.1.1</span>
   <li>
    starts with
    <ul>
     <li><a href="#code-unit-prefix">definition of</a><span>, in §4.6</span>
     <li><a href="#byte-sequence-starts-with">dfn for byte sequence</a><span>, in §4.4</span>
    </ul>
   <li><a href="#strictly-split">strictly split</a><span>, in §4.6</span>
   <li><a href="#strictly-split">strictly split a string</a><span>, in §4.6</span>
   <li><a href="#string">string</a><span>, in §4.6</span>
   <li><a href="#strip-and-collapse-ascii-whitespace">strip and collapse ASCII whitespace</a><span>, in §4.6</span>
   <li><a href="#strip-leading-and-trailing-ascii-whitespace">strip leading and trailing ASCII whitespace</a><span>, in §4.6</span>
   <li><a href="#strip-newlines">strip newlines</a><span>, in §4.6</span>
   <li><a href="#struct">struct</a><span>, in §5.3</span>
   <li><a href="#set-subset">subset</a><span>, in §5.1.3</span>
   <li><a href="#set-superset">superset</a><span>, in §5.1.3</span>
   <li><a href="#surrogate">surrogate</a><span>, in §4.5</span>
   <li><a href="#svg-namespace">SVG namespace</a><span>, in §8</span>
   <li><a href="#the-range">the range</a><span>, in §5.1.3</span>
   <li><a href="#tuple">tuple</a><span>, in §5.3</span>
   <li><a href="#set-union">union</a><span>, in §5.1.3</span>
   <li><a href="#user-agent">user agent</a><span>, in §2.3</span>
   <li><a href="#map-value">value</a><span>, in §5.2</span>
   <li><a href="#iteration-while">while</a><span>, in §3.4</span>
   <li><a href="#willful-violation">willful violation</a><span>, in §2.2</span>
   <li><a href="#xlink-namespace">XLink namespace</a><span>, in §8</span>
   <li><a href="#xml-namespace">XML namespace</a><span>, in §8</span>
   <li><a href="#xmlns-namespace">XMLNS namespace</a><span>, in §8</span>
  </ul>
  <aside class="dfn-panel" data-for="term-for-sec-json.parse">
   <a href="https://tc39.github.io/ecma262/#sec-json.parse">https://tc39.github.io/ecma262/#sec-json.parse</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-sec-json.parse">6. JSON</a> <a href="#ref-for-sec-json.parse①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-sec-json.stringify">
   <a href="https://tc39.github.io/ecma262/#sec-json.stringify">https://tc39.github.io/ecma262/#sec-json.stringify</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-sec-json.stringify">6. JSON</a> <a href="#ref-for-sec-json.stringify①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-sec-call">
   <a href="https://tc39.github.io/ecma262/#sec-call">https://tc39.github.io/ecma262/#sec-call</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-sec-call">6. JSON</a> <a href="#ref-for-sec-call①">(2)</a> <a href="#ref-for-sec-call②">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-sec-get-o-p">
   <a href="https://tc39.github.io/ecma262/#sec-get-o-p">https://tc39.github.io/ecma262/#sec-get-o-p</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-sec-get-o-p">6. JSON</a> <a href="#ref-for-sec-get-o-p①">(2)</a> <a href="#ref-for-sec-get-o-p②">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-sec-isarray">
   <a href="https://tc39.github.io/ecma262/#sec-isarray">https://tc39.github.io/ecma262/#sec-isarray</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-sec-isarray">6. JSON</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-sec-tolength">
   <a href="https://tc39.github.io/ecma262/#sec-tolength">https://tc39.github.io/ecma262/#sec-tolength</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-sec-tolength">6. JSON</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-sec-tostring">
   <a href="https://tc39.github.io/ecma262/#sec-tostring">https://tc39.github.io/ecma262/#sec-tostring</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-sec-tostring">6. JSON</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-sec-ecmascript-data-types-and-values">
   <a href="https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values">https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-sec-ecmascript-data-types-and-values">6. JSON</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-sec-list-and-record-specification-type">
   <a href="https://tc39.github.io/ecma262/#sec-list-and-record-specification-type">https://tc39.github.io/ecma262/#sec-list-and-record-specification-type</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-sec-list-and-record-specification-type">5.1. Lists</a> <a href="#ref-for-sec-list-and-record-specification-type①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-realm">
   <a href="https://tc39.github.io/ecma262/#realm">https://tc39.github.io/ecma262/#realm</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-realm">6. JSON</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-sec-array.prototype.sort">
   <a href="https://tc39.github.io/ecma262/#sec-array.prototype.sort">https://tc39.github.io/ecma262/#sec-array.prototype.sort</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-sec-array.prototype.sort">4.6. Strings</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-sec-ecmascript-language-types-string-type">
   <a href="https://tc39.github.io/ecma262/#sec-ecmascript-language-types-string-type">https://tc39.github.io/ecma262/#sec-ecmascript-language-types-string-type</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-sec-ecmascript-language-types-string-type">4.6. Strings</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-utf-8-decode">
   <a href="https://encoding.spec.whatwg.org/#utf-8-decode">https://encoding.spec.whatwg.org/#utf-8-decode</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-utf-8-decode">3.1. Variables</a>
    <li><a href="#ref-for-utf-8-decode①">4.3. Bytes</a>
    <li><a href="#ref-for-utf-8-decode②">4.6. Strings</a>
    <li><a href="#ref-for-utf-8-decode③">6. JSON</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-utf-8-encode">
   <a href="https://encoding.spec.whatwg.org/#utf-8-encode">https://encoding.spec.whatwg.org/#utf-8-encode</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-utf-8-encode">4.4. Byte sequences</a>
    <li><a href="#ref-for-utf-8-encode①">4.6. Strings</a> <a href="#ref-for-utf-8-encode②">(2)</a>
    <li><a href="#ref-for-utf-8-encode③">6. JSON</a>
   </ul>
  </aside>
  <h3 class="no-num no-ref heading settled" id="index-defined-elsewhere"><span class="content">Terms defined by reference</span><a class="self-link" href="#index-defined-elsewhere"></a></h3>
  <ul class="index">
   <li>
    <a data-link-type="biblio">[ECMA-262]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-sec-json.parse" style="color:initial">%jsonparse%</span>
     <li><span class="dfn-paneled" id="term-for-sec-json.stringify" style="color:initial">%jsonstringify%</span>
     <li><span class="dfn-paneled" id="term-for-sec-call" style="color:initial">Call</span>
     <li><span class="dfn-paneled" id="term-for-sec-get-o-p" style="color:initial">Get</span>
     <li><span class="dfn-paneled" id="term-for-sec-isarray" style="color:initial">IsArray</span>
     <li><span class="dfn-paneled" id="term-for-sec-tolength" style="color:initial">ToLength</span>
     <li><span class="dfn-paneled" id="term-for-sec-tostring" style="color:initial">ToString</span>
     <li><span class="dfn-paneled" id="term-for-sec-ecmascript-data-types-and-values" style="color:initial">Type</span>
     <li><span class="dfn-paneled" id="term-for-sec-list-and-record-specification-type" style="color:initial">list</span>
     <li><span class="dfn-paneled" id="term-for-realm" style="color:initial">realm</span>
     <li><span class="dfn-paneled" id="term-for-sec-array.prototype.sort" style="color:initial">sort()</span>
     <li><span class="dfn-paneled" id="term-for-sec-ecmascript-language-types-string-type" style="color:initial">the string type</span>
    </ul>
   <li>
    <a data-link-type="biblio">[ENCODING]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-utf-8-decode" style="color:initial">utf-8 decode</span>
     <li><span class="dfn-paneled" id="term-for-utf-8-encode" style="color:initial">utf-8 encode</span>
    </ul>
  </ul>
  <h2 class="no-num no-ref heading settled" id="references"><span class="content">References</span><a class="self-link" href="#references"></a></h2>
  <h3 class="no-num no-ref heading settled" id="normative"><span class="content">Normative References</span><a class="self-link" href="#normative"></a></h3>
  <dl>
   <dt id="biblio-ecma-262">[ECMA-262]
   <dd><a href="https://tc39.github.io/ecma262/">ECMAScript Language Specification</a>. URL: <a href="https://tc39.github.io/ecma262/">https://tc39.github.io/ecma262/</a>
   <dt id="biblio-encoding">[ENCODING]
   <dd>Anne van Kesteren. <a href="https://encoding.spec.whatwg.org/">Encoding Standard</a>. Living Standard. URL: <a href="https://encoding.spec.whatwg.org/">https://encoding.spec.whatwg.org/</a>
   <dt id="biblio-rfc20">[RFC20]
   <dd>V.G. Cerf. <a href="https://tools.ietf.org/html/rfc20">ASCII format for network interchange</a>. October 1969. Internet Standard. URL: <a href="https://tools.ietf.org/html/rfc20">https://tools.ietf.org/html/rfc20</a>
   <dt id="biblio-rfc2119">[RFC2119]
   <dd>S. Bradner. <a href="https://tools.ietf.org/html/rfc2119">Key words for use in RFCs to Indicate Requirement Levels</a>. March 1997. Best Current Practice. URL: <a href="https://tools.ietf.org/html/rfc2119">https://tools.ietf.org/html/rfc2119</a>
   <dt id="biblio-rfc4648">[RFC4648]
   <dd>S. Josefsson. <a href="https://tools.ietf.org/html/rfc4648">The Base16, Base32, and Base64 Data Encodings</a>. October 2006. Proposed Standard. URL: <a href="https://tools.ietf.org/html/rfc4648">https://tools.ietf.org/html/rfc4648</a>
   <dt id="biblio-unicode">[UNICODE]
   <dd><a href="https://www.unicode.org/versions/latest/">The Unicode Standard</a>. URL: <a href="https://www.unicode.org/versions/latest/">https://www.unicode.org/versions/latest/</a>
  </dl>
  <h3 class="no-num no-ref heading settled" id="informative"><span class="content">Informative References</span><a class="self-link" href="#informative"></a></h3>
  <dl>
   <dt id="biblio-rfc8174">[RFC8174]
   <dd>B. Leiba. <a href="https://tools.ietf.org/html/rfc8174">Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</a>. May 2017. Best Current Practice. URL: <a href="https://tools.ietf.org/html/rfc8174">https://tools.ietf.org/html/rfc8174</a>
  </dl>
  <aside class="dfn-panel" data-for="willful-violation">
   <b><a href="#willful-violation">#willful-violation</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-willful-violation">2.1. Conformance</a>
    <li><a href="#ref-for-willful-violation①">2.2. Compliance with other specifications</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="abort-when">
   <b><a href="#abort-when">#abort-when</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-abort-when">3.3. Conditional abort</a> <a href="#ref-for-abort-when①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="if-aborted">
   <b><a href="#if-aborted">#if-aborted</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-if-aborted">3.3. Conditional abort</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="iteration-while">
   <b><a href="#iteration-while">#iteration-while</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-iteration-while">4.4. Byte sequences</a>
    <li><a href="#ref-for-iteration-while①">4.6. Strings</a>
    <li><a href="#ref-for-iteration-while②">5.1.1. Stacks</a>
    <li><a href="#ref-for-iteration-while③">5.1.2. Queues</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="iteration-continue">
   <b><a href="#iteration-continue">#iteration-continue</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-iteration-continue">3.4. Iteration</a> <a href="#ref-for-iteration-continue①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="iteration-break">
   <b><a href="#iteration-break">#iteration-break</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-iteration-break">3.4. Iteration</a> <a href="#ref-for-iteration-break①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="assert">
   <b><a href="#assert">#assert</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-assert">3.1. Variables</a>
    <li><a href="#ref-for-assert①">3.5. Assertions</a>
    <li><a href="#ref-for-assert②">4.6. Strings</a> <a href="#ref-for-assert③">(2)</a> <a href="#ref-for-assert④">(3)</a> <a href="#ref-for-assert⑤">(4)</a> <a href="#ref-for-assert⑥">(5)</a>
    <li><a href="#ref-for-assert⑦">5.1. Lists</a> <a href="#ref-for-assert⑧">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="boolean">
   <b><a href="#boolean">#boolean</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-boolean">6. JSON</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="byte">
   <b><a href="#byte">#byte</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-byte">4.3. Bytes</a>
    <li><a href="#ref-for-byte①">4.4. Byte sequences</a> <a href="#ref-for-byte②">(2)</a> <a href="#ref-for-byte③">(3)</a> <a href="#ref-for-byte④">(4)</a> <a href="#ref-for-byte⑤">(5)</a> <a href="#ref-for-byte⑥">(6)</a> <a href="#ref-for-byte⑦">(7)</a> <a href="#ref-for-byte⑧">(8)</a>
    <li><a href="#ref-for-byte⑨">4.6. Strings</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="ascii-byte">
   <b><a href="#ascii-byte">#ascii-byte</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ascii-byte">4.3. Bytes</a>
    <li><a href="#ref-for-ascii-byte①">4.6. Strings</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="byte-sequence">
   <b><a href="#byte-sequence">#byte-sequence</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-byte-sequence">4.4. Byte sequences</a> <a href="#ref-for-byte-sequence①">(2)</a> <a href="#ref-for-byte-sequence②">(3)</a> <a href="#ref-for-byte-sequence③">(4)</a> <a href="#ref-for-byte-sequence④">(5)</a> <a href="#ref-for-byte-sequence⑤">(6)</a> <a href="#ref-for-byte-sequence⑥">(7)</a> <a href="#ref-for-byte-sequence⑦">(8)</a> <a href="#ref-for-byte-sequence⑧">(9)</a> <a href="#ref-for-byte-sequence⑨">(10)</a> <a href="#ref-for-byte-sequence①⓪">(11)</a> <a href="#ref-for-byte-sequence①①">(12)</a>
    <li><a href="#ref-for-byte-sequence①②">4.6. Strings</a> <a href="#ref-for-byte-sequence①③">(2)</a> <a href="#ref-for-byte-sequence①④">(3)</a>
    <li><a href="#ref-for-byte-sequence①⑤">5.2. Maps</a>
    <li><a href="#ref-for-byte-sequence①⑥">7. Forgiving base64</a> <a href="#ref-for-byte-sequence①⑦">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="byte-sequence-length">
   <b><a href="#byte-sequence-length">#byte-sequence-length</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-byte-sequence-length">4.4. Byte sequences</a> <a href="#ref-for-byte-sequence-length①">(2)</a> <a href="#ref-for-byte-sequence-length②">(3)</a>
    <li><a href="#ref-for-byte-sequence-length③">4.6. Strings</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="byte-lowercase">
   <b><a href="#byte-lowercase">#byte-lowercase</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-byte-lowercase">4.4. Byte sequences</a> <a href="#ref-for-byte-lowercase①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="byte-sequence-starts-with">
   <b><a href="#byte-sequence-starts-with">#byte-sequence-starts-with</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-byte-sequence-starts-with">4.4. Byte sequences</a> <a href="#ref-for-byte-sequence-starts-with①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="isomorphic-decode">
   <b><a href="#isomorphic-decode">#isomorphic-decode</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-isomorphic-decode">4.6. Strings</a> <a href="#ref-for-isomorphic-decode①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="code-point">
   <b><a href="#code-point">#code-point</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-code-point">4.3. Bytes</a>
    <li><a href="#ref-for-code-point①">4.4. Byte sequences</a>
    <li><a href="#ref-for-code-point②">4.5. Code points</a> <a href="#ref-for-code-point③">(2)</a> <a href="#ref-for-code-point④">(3)</a> <a href="#ref-for-code-point⑤">(4)</a> <a href="#ref-for-code-point⑥">(5)</a> <a href="#ref-for-code-point⑦">(6)</a> <a href="#ref-for-code-point⑧">(7)</a> <a href="#ref-for-code-point⑨">(8)</a> <a href="#ref-for-code-point①⓪">(9)</a> <a href="#ref-for-code-point①①">(10)</a> <a href="#ref-for-code-point①②">(11)</a> <a href="#ref-for-code-point①③">(12)</a> <a href="#ref-for-code-point①④">(13)</a> <a href="#ref-for-code-point①⑤">(14)</a> <a href="#ref-for-code-point①⑥">(15)</a> <a href="#ref-for-code-point①⑦">(16)</a> <a href="#ref-for-code-point①⑧">(17)</a> <a href="#ref-for-code-point①⑨">(18)</a> <a href="#ref-for-code-point②⓪">(19)</a>
    <li><a href="#ref-for-code-point②①">4.6. Strings</a> <a href="#ref-for-code-point②②">(2)</a> <a href="#ref-for-code-point②③">(3)</a> <a href="#ref-for-code-point②④">(4)</a> <a href="#ref-for-code-point②⑤">(5)</a> <a href="#ref-for-code-point②⑥">(6)</a> <a href="#ref-for-code-point②⑦">(7)</a> <a href="#ref-for-code-point②⑧">(8)</a> <a href="#ref-for-code-point②⑨">(9)</a> <a href="#ref-for-code-point③⓪">(10)</a> <a href="#ref-for-code-point③①">(11)</a> <a href="#ref-for-code-point③②">(12)</a> <a href="#ref-for-code-point③③">(13)</a> <a href="#ref-for-code-point③④">(14)</a> <a href="#ref-for-code-point③⑤">(15)</a> <a href="#ref-for-code-point③⑥">(16)</a> <a href="#ref-for-code-point③⑦">(17)</a> <a href="#ref-for-code-point③⑧">(18)</a> <a href="#ref-for-code-point③⑨">(19)</a> <a href="#ref-for-code-point④⓪">(20)</a> <a href="#ref-for-code-point④①">(21)</a> <a href="#ref-for-code-point④②">(22)</a> <a href="#ref-for-code-point④③">(23)</a> <a href="#ref-for-code-point④④">(24)</a> <a href="#ref-for-code-point④⑤">(25)</a> <a href="#ref-for-code-point④⑥">(26)</a> <a href="#ref-for-code-point④⑦">(27)</a>
    <li><a href="#ref-for-code-point④⑧">7. Forgiving base64</a> <a href="#ref-for-code-point④⑨">(2)</a> <a href="#ref-for-code-point⑤⓪">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="surrogate">
   <b><a href="#surrogate">#surrogate</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-surrogate">4.5. Code points</a>
    <li><a href="#ref-for-surrogate①">4.6. Strings</a> <a href="#ref-for-surrogate②">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="scalar-value">
   <b><a href="#scalar-value">#scalar-value</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-scalar-value">4.6. Strings</a> <a href="#ref-for-scalar-value①">(2)</a> <a href="#ref-for-scalar-value②">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="ascii-code-point">
   <b><a href="#ascii-code-point">#ascii-code-point</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ascii-code-point">4.6. Strings</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="ascii-whitespace">
   <b><a href="#ascii-whitespace">#ascii-whitespace</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ascii-whitespace">4.6. Strings</a> <a href="#ref-for-ascii-whitespace①">(2)</a> <a href="#ref-for-ascii-whitespace②">(3)</a> <a href="#ref-for-ascii-whitespace③">(4)</a> <a href="#ref-for-ascii-whitespace④">(5)</a> <a href="#ref-for-ascii-whitespace⑤">(6)</a>
    <li><a href="#ref-for-ascii-whitespace⑥">7. Forgiving base64</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="c0-control">
   <b><a href="#c0-control">#c0-control</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-c0-control">4.5. Code points</a> <a href="#ref-for-c0-control①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="ascii-digit">
   <b><a href="#ascii-digit">#ascii-digit</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ascii-digit">4.5. Code points</a> <a href="#ref-for-ascii-digit①">(2)</a> <a href="#ref-for-ascii-digit②">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="ascii-upper-hex-digit">
   <b><a href="#ascii-upper-hex-digit">#ascii-upper-hex-digit</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ascii-upper-hex-digit">4.5. Code points</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="ascii-lower-hex-digit">
   <b><a href="#ascii-lower-hex-digit">#ascii-lower-hex-digit</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ascii-lower-hex-digit">4.5. Code points</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="ascii-upper-alpha">
   <b><a href="#ascii-upper-alpha">#ascii-upper-alpha</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ascii-upper-alpha">4.5. Code points</a>
    <li><a href="#ref-for-ascii-upper-alpha①">4.6. Strings</a> <a href="#ref-for-ascii-upper-alpha②">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="ascii-lower-alpha">
   <b><a href="#ascii-lower-alpha">#ascii-lower-alpha</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ascii-lower-alpha">4.5. Code points</a>
    <li><a href="#ref-for-ascii-lower-alpha①">4.6. Strings</a> <a href="#ref-for-ascii-lower-alpha②">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="ascii-alpha">
   <b><a href="#ascii-alpha">#ascii-alpha</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ascii-alpha">4.5. Code points</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="ascii-alphanumeric">
   <b><a href="#ascii-alphanumeric">#ascii-alphanumeric</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ascii-alphanumeric">7. Forgiving base64</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="javascript-string">
   <b><a href="#javascript-string">#javascript-string</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-javascript-string">4.6. Strings</a> <a href="#ref-for-javascript-string①">(2)</a> <a href="#ref-for-javascript-string②">(3)</a> <a href="#ref-for-javascript-string③">(4)</a> <a href="#ref-for-javascript-string④">(5)</a> <a href="#ref-for-javascript-string⑤">(6)</a> <a href="#ref-for-javascript-string⑥">(7)</a> <a href="#ref-for-javascript-string⑦">(8)</a> <a href="#ref-for-javascript-string⑧">(9)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="code-unit">
   <b><a href="#code-unit">#code-unit</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-code-unit">4.6. Strings</a> <a href="#ref-for-code-unit①">(2)</a> <a href="#ref-for-code-unit②">(3)</a> <a href="#ref-for-code-unit③">(4)</a> <a href="#ref-for-code-unit④">(5)</a> <a href="#ref-for-code-unit⑤">(6)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="scalar-value-string">
   <b><a href="#scalar-value-string">#scalar-value-string</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-scalar-value-string">4.6. Strings</a> <a href="#ref-for-scalar-value-string①">(2)</a> <a href="#ref-for-scalar-value-string②">(3)</a> <a href="#ref-for-scalar-value-string③">(4)</a> <a href="#ref-for-scalar-value-string④">(5)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="string">
   <b><a href="#string">#string</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-string">3.1. Variables</a> <a href="#ref-for-string①">(2)</a>
    <li><a href="#ref-for-string②">4.4. Byte sequences</a> <a href="#ref-for-string③">(2)</a> <a href="#ref-for-string④">(3)</a>
    <li><a href="#ref-for-string⑤">4.6. Strings</a> <a href="#ref-for-string⑥">(2)</a> <a href="#ref-for-string⑦">(3)</a> <a href="#ref-for-string⑧">(4)</a> <a href="#ref-for-string⑨">(5)</a> <a href="#ref-for-string①⓪">(6)</a> <a href="#ref-for-string①①">(7)</a> <a href="#ref-for-string①②">(8)</a> <a href="#ref-for-string①③">(9)</a> <a href="#ref-for-string①④">(10)</a> <a href="#ref-for-string①⑤">(11)</a> <a href="#ref-for-string①⑥">(12)</a> <a href="#ref-for-string①⑦">(13)</a> <a href="#ref-for-string①⑧">(14)</a> <a href="#ref-for-string①⑨">(15)</a> <a href="#ref-for-string②⓪">(16)</a> <a href="#ref-for-string②①">(17)</a> <a href="#ref-for-string②②">(18)</a> <a href="#ref-for-string②③">(19)</a> <a href="#ref-for-string②④">(20)</a> <a href="#ref-for-string②⑤">(21)</a> <a href="#ref-for-string②⑥">(22)</a> <a href="#ref-for-string②⑦">(23)</a> <a href="#ref-for-string②⑧">(24)</a> <a href="#ref-for-string②⑨">(25)</a> <a href="#ref-for-string③⓪">(26)</a> <a href="#ref-for-string③①">(27)</a> <a href="#ref-for-string③②">(28)</a> <a href="#ref-for-string③③">(29)</a> <a href="#ref-for-string③④">(30)</a> <a href="#ref-for-string③⑤">(31)</a> <a href="#ref-for-string③⑥">(32)</a> <a href="#ref-for-string③⑦">(33)</a> <a href="#ref-for-string③⑧">(34)</a>
    <li><a href="#ref-for-string③⑨">5.1. Lists</a> <a href="#ref-for-string④⓪">(2)</a> <a href="#ref-for-string④①">(3)</a>
    <li><a href="#ref-for-string④②">6. JSON</a> <a href="#ref-for-string④③">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="string-length">
   <b><a href="#string-length">#string-length</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-string-length">4.4. Byte sequences</a>
    <li><a href="#ref-for-string-length①">4.6. Strings</a> <a href="#ref-for-string-length②">(2)</a> <a href="#ref-for-string-length③">(3)</a>
    <li><a href="#ref-for-string-length④">7. Forgiving base64</a> <a href="#ref-for-string-length⑤">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="javascript-string-convert">
   <b><a href="#javascript-string-convert">#javascript-string-convert</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-javascript-string-convert">4.6. Strings</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="code-unit-prefix">
   <b><a href="#code-unit-prefix">#code-unit-prefix</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-code-unit-prefix">4.6. Strings</a> <a href="#ref-for-code-unit-prefix①">(2)</a> <a href="#ref-for-code-unit-prefix②">(3)</a> <a href="#ref-for-code-unit-prefix③">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="code-unit-less-than">
   <b><a href="#code-unit-less-than">#code-unit-less-than</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-code-unit-less-than">5.1. Lists</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="isomorphic-encode">
   <b><a href="#isomorphic-encode">#isomorphic-encode</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-isomorphic-encode">4.4. Byte sequences</a>
    <li><a href="#ref-for-isomorphic-encode①">4.6. Strings</a> <a href="#ref-for-isomorphic-encode②">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="ascii-string">
   <b><a href="#ascii-string">#ascii-string</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ascii-string">4.6. Strings</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="ascii-lowercase">
   <b><a href="#ascii-lowercase">#ascii-lowercase</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ascii-lowercase">4.6. Strings</a> <a href="#ref-for-ascii-lowercase①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="ascii-uppercase">
   <b><a href="#ascii-uppercase">#ascii-uppercase</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ascii-uppercase">4.5. Code points</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="strip-leading-and-trailing-ascii-whitespace">
   <b><a href="#strip-leading-and-trailing-ascii-whitespace">#strip-leading-and-trailing-ascii-whitespace</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-strip-leading-and-trailing-ascii-whitespace">4.6. Strings</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="collect-a-sequence-of-code-points">
   <b><a href="#collect-a-sequence-of-code-points">#collect-a-sequence-of-code-points</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-collect-a-sequence-of-code-points">4.6. Strings</a> <a href="#ref-for-collect-a-sequence-of-code-points①">(2)</a> <a href="#ref-for-collect-a-sequence-of-code-points②">(3)</a> <a href="#ref-for-collect-a-sequence-of-code-points③">(4)</a> <a href="#ref-for-collect-a-sequence-of-code-points④">(5)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="string-position-variable">
   <b><a href="#string-position-variable">#string-position-variable</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-string-position-variable">4.6. Strings</a> <a href="#ref-for-string-position-variable①">(2)</a> <a href="#ref-for-string-position-variable②">(3)</a> <a href="#ref-for-string-position-variable③">(4)</a> <a href="#ref-for-string-position-variable④">(5)</a>
    <li><a href="#ref-for-string-position-variable⑤">7. Forgiving base64</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="skip-ascii-whitespace">
   <b><a href="#skip-ascii-whitespace">#skip-ascii-whitespace</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-skip-ascii-whitespace">4.6. Strings</a> <a href="#ref-for-skip-ascii-whitespace①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="split-on-ascii-whitespace">
   <b><a href="#split-on-ascii-whitespace">#split-on-ascii-whitespace</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-split-on-ascii-whitespace">4.6. Strings</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="split-on-commas">
   <b><a href="#split-on-commas">#split-on-commas</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-split-on-commas">4.6. Strings</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="string-concatenate">
   <b><a href="#string-concatenate">#string-concatenate</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-string-concatenate">4.6. Strings</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="list">
   <b><a href="#list">#list</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-list">3.1. Variables</a>
    <li><a href="#ref-for-list①">3.3. Conditional abort</a> <a href="#ref-for-list②">(2)</a>
    <li><a href="#ref-for-list③">3.4. Iteration</a>
    <li><a href="#ref-for-list④">4.6. Strings</a> <a href="#ref-for-list⑤">(2)</a> <a href="#ref-for-list⑥">(3)</a> <a href="#ref-for-list⑦">(4)</a>
    <li><a href="#ref-for-list⑧">5.1. Lists</a> <a href="#ref-for-list⑨">(2)</a> <a href="#ref-for-list①⓪">(3)</a> <a href="#ref-for-list①①">(4)</a> <a href="#ref-for-list①②">(5)</a> <a href="#ref-for-list①③">(6)</a> <a href="#ref-for-list①④">(7)</a> <a href="#ref-for-list①⑤">(8)</a> <a href="#ref-for-list①⑥">(9)</a> <a href="#ref-for-list①⑦">(10)</a> <a href="#ref-for-list①⑧">(11)</a> <a href="#ref-for-list①⑨">(12)</a> <a href="#ref-for-list②⓪">(13)</a> <a href="#ref-for-list②①">(14)</a> <a href="#ref-for-list②②">(15)</a> <a href="#ref-for-list②③">(16)</a> <a href="#ref-for-list②④">(17)</a> <a href="#ref-for-list②⑤">(18)</a> <a href="#ref-for-list②⑥">(19)</a> <a href="#ref-for-list②⑦">(20)</a> <a href="#ref-for-list②⑧">(21)</a> <a href="#ref-for-list②⑨">(22)</a> <a href="#ref-for-list③⓪">(23)</a> <a href="#ref-for-list③①">(24)</a> <a href="#ref-for-list③②">(25)</a> <a href="#ref-for-list③③">(26)</a> <a href="#ref-for-list③④">(27)</a> <a href="#ref-for-list③⑤">(28)</a>
    <li><a href="#ref-for-list③⑥">5.1.1. Stacks</a> <a href="#ref-for-list③⑦">(2)</a> <a href="#ref-for-list③⑧">(3)</a>
    <li><a href="#ref-for-list③⑨">5.1.2. Queues</a> <a href="#ref-for-list④⓪">(2)</a> <a href="#ref-for-list④①">(3)</a>
    <li><a href="#ref-for-list④②">5.1.3. Sets</a> <a href="#ref-for-list④③">(2)</a> <a href="#ref-for-list④④">(3)</a> <a href="#ref-for-list④⑤">(4)</a>
    <li><a href="#ref-for-list④⑥">5.2. Maps</a> <a href="#ref-for-list④⑦">(2)</a>
    <li><a href="#ref-for-list④⑧">6. JSON</a> <a href="#ref-for-list④⑨">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="list-item">
   <b><a href="#list-item">#list-item</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-list-item">4.6. Strings</a>
    <li><a href="#ref-for-list-item①">5. Data structures</a>
    <li><a href="#ref-for-list-item②">5.1. Lists</a> <a href="#ref-for-list-item③">(2)</a> <a href="#ref-for-list-item④">(3)</a> <a href="#ref-for-list-item⑤">(4)</a> <a href="#ref-for-list-item⑥">(5)</a> <a href="#ref-for-list-item⑦">(6)</a> <a href="#ref-for-list-item⑧">(7)</a> <a href="#ref-for-list-item⑨">(8)</a> <a href="#ref-for-list-item①⓪">(9)</a> <a href="#ref-for-list-item①①">(10)</a> <a href="#ref-for-list-item①②">(11)</a> <a href="#ref-for-list-item①③">(12)</a> <a href="#ref-for-list-item①④">(13)</a> <a href="#ref-for-list-item①⑤">(14)</a>
    <li><a href="#ref-for-list-item①⑥">5.1.1. Stacks</a>
    <li><a href="#ref-for-list-item①⑦">5.1.2. Queues</a>
    <li><a href="#ref-for-list-item①⑧">5.1.3. Sets</a> <a href="#ref-for-list-item①⑨">(2)</a> <a href="#ref-for-list-item②⓪">(3)</a>
    <li><a href="#ref-for-list-item②①">5.2. Maps</a> <a href="#ref-for-list-item②②">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="list-append">
   <b><a href="#list-append">#list-append</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-list-append">3.3. Conditional abort</a> <a href="#ref-for-list-append①">(2)</a> <a href="#ref-for-list-append②">(3)</a> <a href="#ref-for-list-append③">(4)</a> <a href="#ref-for-list-append④">(5)</a> <a href="#ref-for-list-append⑤">(6)</a> <a href="#ref-for-list-append⑥">(7)</a> <a href="#ref-for-list-append⑦">(8)</a>
    <li><a href="#ref-for-list-append⑧">4.6. Strings</a> <a href="#ref-for-list-append⑨">(2)</a> <a href="#ref-for-list-append①⓪">(3)</a> <a href="#ref-for-list-append①①">(4)</a>
    <li><a href="#ref-for-list-append①②">5.1. Lists</a> <a href="#ref-for-list-append①③">(2)</a>
    <li><a href="#ref-for-list-append①④">5.1.1. Stacks</a> <a href="#ref-for-list-append①⑤">(2)</a>
    <li><a href="#ref-for-list-append①⑥">5.1.2. Queues</a> <a href="#ref-for-list-append①⑦">(2)</a>
    <li><a href="#ref-for-list-append①⑧">5.1.3. Sets</a>
    <li><a href="#ref-for-list-append①⑨">5.2. Maps</a>
    <li><a href="#ref-for-list-append②⓪">6. JSON</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="list-extend">
   <b><a href="#list-extend">#list-extend</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-list-extend">5.1. Lists</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="list-prepend">
   <b><a href="#list-prepend">#list-prepend</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-list-prepend">5.1. Lists</a>
    <li><a href="#ref-for-list-prepend①">5.1.1. Stacks</a>
    <li><a href="#ref-for-list-prepend②">5.1.2. Queues</a>
    <li><a href="#ref-for-list-prepend③">5.1.3. Sets</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="list-remove">
   <b><a href="#list-remove">#list-remove</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-list-remove">5.1. Lists</a> <a href="#ref-for-list-remove①">(2)</a> <a href="#ref-for-list-remove②">(3)</a>
    <li><a href="#ref-for-list-remove③">5.1.1. Stacks</a> <a href="#ref-for-list-remove④">(2)</a>
    <li><a href="#ref-for-list-remove⑤">5.1.2. Queues</a> <a href="#ref-for-list-remove⑥">(2)</a>
    <li><a href="#ref-for-list-remove⑦">5.1.3. Sets</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="list-contain">
   <b><a href="#list-contain">#list-contain</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-list-contain">5. Data structures</a>
    <li><a href="#ref-for-list-contain①">5.1. Lists</a> <a href="#ref-for-list-contain②">(2)</a> <a href="#ref-for-list-contain③">(3)</a> <a href="#ref-for-list-contain④">(4)</a>
    <li><a href="#ref-for-list-contain⑤">5.1.3. Sets</a> <a href="#ref-for-list-contain⑥">(2)</a> <a href="#ref-for-list-contain⑦">(3)</a> <a href="#ref-for-list-contain⑧">(4)</a> <a href="#ref-for-list-contain⑨">(5)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="list-size">
   <b><a href="#list-size">#list-size</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-list-size">5.1. Lists</a> <a href="#ref-for-list-size①">(2)</a>
    <li><a href="#ref-for-list-size②">5.2. Maps</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="list-is-empty">
   <b><a href="#list-is-empty">#list-is-empty</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-list-is-empty">4.6. Strings</a>
    <li><a href="#ref-for-list-is-empty①">5.1.1. Stacks</a>
    <li><a href="#ref-for-list-is-empty②">5.1.2. Queues</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="list-iterate">
   <b><a href="#list-iterate">#list-iterate</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-list-iterate">3.4. Iteration</a> <a href="#ref-for-list-iterate①">(2)</a> <a href="#ref-for-list-iterate②">(3)</a> <a href="#ref-for-list-iterate③">(4)</a>
    <li><a href="#ref-for-list-iterate④">5.1. Lists</a> <a href="#ref-for-list-iterate⑤">(2)</a> <a href="#ref-for-list-iterate⑥">(3)</a>
    <li><a href="#ref-for-list-iterate⑦">5.1.1. Stacks</a>
    <li><a href="#ref-for-list-iterate⑧">5.1.2. Queues</a>
    <li><a href="#ref-for-list-iterate⑨">5.1.3. Sets</a> <a href="#ref-for-list-iterate①⓪">(2)</a> <a href="#ref-for-list-iterate①①">(3)</a> <a href="#ref-for-list-iterate①②">(4)</a>
    <li><a href="#ref-for-list-iterate①③">6. JSON</a> <a href="#ref-for-list-iterate①④">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="list-clone">
   <b><a href="#list-clone">#list-clone</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-list-clone">5.1. Lists</a>
    <li><a href="#ref-for-list-clone①">5.1.3. Sets</a>
    <li><a href="#ref-for-list-clone②">5.2. Maps</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="list-sort-in-ascending-order">
   <b><a href="#list-sort-in-ascending-order">#list-sort-in-ascending-order</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-list-sort-in-ascending-order">5.1. Lists</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="stack">
   <b><a href="#stack">#stack</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-stack">5.1.1. Stacks</a> <a href="#ref-for-stack①">(2)</a> <a href="#ref-for-stack②">(3)</a> <a href="#ref-for-stack③">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="stack-pop">
   <b><a href="#stack-pop">#stack-pop</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-stack-pop">5.1.1. Stacks</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="queue">
   <b><a href="#queue">#queue</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-queue">5.1.2. Queues</a> <a href="#ref-for-queue①">(2)</a> <a href="#ref-for-queue②">(3)</a> <a href="#ref-for-queue③">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="queue-dequeue">
   <b><a href="#queue-dequeue">#queue-dequeue</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-queue-dequeue">5.1.2. Queues</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="ordered-set">
   <b><a href="#ordered-set">#ordered-set</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ordered-set">5. Data structures</a>
    <li><a href="#ref-for-ordered-set①">5.1. Lists</a> <a href="#ref-for-ordered-set②">(2)</a> <a href="#ref-for-ordered-set③">(3)</a> <a href="#ref-for-ordered-set④">(4)</a> <a href="#ref-for-ordered-set⑤">(5)</a> <a href="#ref-for-ordered-set⑥">(6)</a>
    <li><a href="#ref-for-ordered-set⑦">5.1.3. Sets</a> <a href="#ref-for-ordered-set⑧">(2)</a> <a href="#ref-for-ordered-set⑨">(3)</a> <a href="#ref-for-ordered-set①⓪">(4)</a> <a href="#ref-for-ordered-set①①">(5)</a> <a href="#ref-for-ordered-set①②">(6)</a> <a href="#ref-for-ordered-set①③">(7)</a> <a href="#ref-for-ordered-set①④">(8)</a> <a href="#ref-for-ordered-set①⑤">(9)</a> <a href="#ref-for-ordered-set①⑥">(10)</a> <a href="#ref-for-ordered-set①⑦">(11)</a>
    <li><a href="#ref-for-ordered-set①⑧">5.2. Maps</a> <a href="#ref-for-ordered-set①⑨">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="set-append">
   <b><a href="#set-append">#set-append</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-set-append">5. Data structures</a>
    <li><a href="#ref-for-set-append①">5.1. Lists</a>
    <li><a href="#ref-for-set-append②">5.1.3. Sets</a> <a href="#ref-for-set-append③">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="set-prepend">
   <b><a href="#set-prepend">#set-prepend</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-set-prepend">5.1. Lists</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="set-replace">
   <b><a href="#set-replace">#set-replace</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-set-replace">5.1. Lists</a> <a href="#ref-for-set-replace①">(2)</a>
    <li><a href="#ref-for-set-replace②">5.1.3. Sets</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="set-subset">
   <b><a href="#set-subset">#set-subset</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-set-subset">5.1.3. Sets</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="set-superset">
   <b><a href="#set-superset">#set-superset</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-set-superset">5.1.3. Sets</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="the-range">
   <b><a href="#the-range">#the-range</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-the-range">5.1.3. Sets</a>
    <li><a href="#ref-for-the-range①">6. JSON</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="ordered-map">
   <b><a href="#ordered-map">#ordered-map</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ordered-map">5. Data structures</a>
    <li><a href="#ref-for-ordered-map①">5.2. Maps</a> <a href="#ref-for-ordered-map②">(2)</a> <a href="#ref-for-ordered-map③">(3)</a> <a href="#ref-for-ordered-map④">(4)</a> <a href="#ref-for-ordered-map⑤">(5)</a> <a href="#ref-for-ordered-map⑥">(6)</a> <a href="#ref-for-ordered-map⑦">(7)</a> <a href="#ref-for-ordered-map⑧">(8)</a> <a href="#ref-for-ordered-map⑨">(9)</a> <a href="#ref-for-ordered-map①⓪">(10)</a> <a href="#ref-for-ordered-map①①">(11)</a> <a href="#ref-for-ordered-map①②">(12)</a> <a href="#ref-for-ordered-map①③">(13)</a> <a href="#ref-for-ordered-map①④">(14)</a> <a href="#ref-for-ordered-map①⑤">(15)</a> <a href="#ref-for-ordered-map①⑥">(16)</a> <a href="#ref-for-ordered-map①⑦">(17)</a> <a href="#ref-for-ordered-map①⑧">(18)</a> <a href="#ref-for-ordered-map①⑨">(19)</a> <a href="#ref-for-ordered-map②⓪">(20)</a> <a href="#ref-for-ordered-map②①">(21)</a> <a href="#ref-for-ordered-map②②">(22)</a>
    <li><a href="#ref-for-ordered-map②③">6. JSON</a> <a href="#ref-for-ordered-map②④">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="map-key">
   <b><a href="#map-key">#map-key</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-map-key">5.2. Maps</a> <a href="#ref-for-map-key①">(2)</a> <a href="#ref-for-map-key②">(3)</a> <a href="#ref-for-map-key③">(4)</a> <a href="#ref-for-map-key④">(5)</a> <a href="#ref-for-map-key⑤">(6)</a> <a href="#ref-for-map-key⑥">(7)</a> <a href="#ref-for-map-key⑦">(8)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="map-value">
   <b><a href="#map-value">#map-value</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-map-value">5.2. Maps</a> <a href="#ref-for-map-value①">(2)</a> <a href="#ref-for-map-value②">(3)</a> <a href="#ref-for-map-value③">(4)</a> <a href="#ref-for-map-value④">(5)</a> <a href="#ref-for-map-value⑤">(6)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="map-entry">
   <b><a href="#map-entry">#map-entry</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-map-entry">5.2. Maps</a> <a href="#ref-for-map-entry①">(2)</a> <a href="#ref-for-map-entry②">(3)</a> <a href="#ref-for-map-entry③">(4)</a> <a href="#ref-for-map-entry④">(5)</a> <a href="#ref-for-map-entry⑤">(6)</a> <a href="#ref-for-map-entry⑥">(7)</a> <a href="#ref-for-map-entry⑦">(8)</a> <a href="#ref-for-map-entry⑧">(9)</a> <a href="#ref-for-map-entry⑨">(10)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="map-set">
   <b><a href="#map-set">#map-set</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-map-set">5.2. Maps</a> <a href="#ref-for-map-set①">(2)</a> <a href="#ref-for-map-set②">(3)</a>
    <li><a href="#ref-for-map-set③">6. JSON</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="map-remove">
   <b><a href="#map-remove">#map-remove</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-map-remove">5.2. Maps</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="map-exists">
   <b><a href="#map-exists">#map-exists</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-map-exists">5.2. Maps</a> <a href="#ref-for-map-exists①">(2)</a> <a href="#ref-for-map-exists②">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="map-getting-the-keys">
   <b><a href="#map-getting-the-keys">#map-getting-the-keys</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-map-getting-the-keys">5.2. Maps</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="map-size">
   <b><a href="#map-size">#map-size</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-map-size">5.2. Maps</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="map-iterate">
   <b><a href="#map-iterate">#map-iterate</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-map-iterate">3.4. Iteration</a>
    <li><a href="#ref-for-map-iterate①">5.2. Maps</a> <a href="#ref-for-map-iterate②">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="struct">
   <b><a href="#struct">#struct</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-struct">5.3. Structs</a> <a href="#ref-for-struct①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="struct-item">
   <b><a href="#struct-item">#struct-item</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-struct-item">5.1. Lists</a> <a href="#ref-for-struct-item①">(2)</a>
    <li><a href="#ref-for-struct-item②">5.3. Structs</a> <a href="#ref-for-struct-item③">(2)</a> <a href="#ref-for-struct-item④">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="struct-name">
   <b><a href="#struct-name">#struct-name</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-struct-name">5.3. Structs</a> <a href="#ref-for-struct-name①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="tuple">
   <b><a href="#tuple">#tuple</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-tuple">5.3. Structs</a> <a href="#ref-for-tuple①">(2)</a> <a href="#ref-for-tuple②">(3)</a> <a href="#ref-for-tuple③">(4)</a> <a href="#ref-for-tuple④">(5)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="pair">
   <b><a href="#pair">#pair</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-pair">5.3. Structs</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="convert-a-json-derived-javascript-value-to-an-infra-value">
   <b><a href="#convert-a-json-derived-javascript-value-to-an-infra-value">#convert-a-json-derived-javascript-value-to-an-infra-value</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-convert-a-json-derived-javascript-value-to-an-infra-value">6. JSON</a> <a href="#ref-for-convert-a-json-derived-javascript-value-to-an-infra-value①">(2)</a> <a href="#ref-for-convert-a-json-derived-javascript-value-to-an-infra-value②">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="forgiving-base64-encode">
   <b><a href="#forgiving-base64-encode">#forgiving-base64-encode</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-forgiving-base64-encode">7. Forgiving base64</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="forgiving-base64-decode">
   <b><a href="#forgiving-base64-decode">#forgiving-base64-decode</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-forgiving-base64-decode">7. Forgiving base64</a>
   </ul>
  </aside>
<script>/* script-dfn-panel */

document.body.addEventListener("click", function(e) {
    var queryAll = function(sel) { return [].slice.call(document.querySelectorAll(sel)); }
    // Find the dfn element or panel, if any, that was clicked on.
    var el = e.target;
    var target;
    var hitALink = false;
    while(el.parentElement) {
        if(el.tagName == "A") {
            // Clicking on a link in a <dfn> shouldn't summon the panel
            hitALink = true;
        }
        if(el.classList.contains("dfn-paneled")) {
            target = "dfn";
            break;
        }
        if(el.classList.contains("dfn-panel")) {
            target = "dfn-panel";
            break;
        }
        el = el.parentElement;
    }
    if(target != "dfn-panel") {
        // Turn off any currently "on" or "activated" panels.
        queryAll(".dfn-panel.on, .dfn-panel.activated").forEach(function(el){
            el.classList.remove("on");
            el.classList.remove("activated");
        });
    }
    if(target == "dfn" && !hitALink) {
        // open the panel
        var dfnPanel = document.querySelector(".dfn-panel[data-for='" + el.id + "']");
        if(dfnPanel) {
            dfnPanel.classList.add("on");
            var rect = el.getBoundingClientRect();
            dfnPanel.style.left = window.scrollX + rect.right + 5 + "px";
            dfnPanel.style.top = window.scrollY + rect.top + "px";
            var panelRect = dfnPanel.getBoundingClientRect();
            var panelWidth = panelRect.right - panelRect.left;
            if(panelRect.right > document.body.scrollWidth && (rect.left - (panelWidth + 5)) > 0) {
                // Reposition, because the panel is overflowing
                dfnPanel.style.left = window.scrollX + rect.left - (panelWidth + 5) + "px";
            }
        } else {
            console.log("Couldn't find .dfn-panel[data-for='" + el.id + "']");
        }
    } else if(target == "dfn-panel") {
        // Switch it to "activated" state, which pins it.
        el.classList.add("activated");
        el.style.left = null;
        el.style.top = null;
    }

});
</script>